/* === Design Tokens === */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #4a4a68;
  --color-text-muted: #7a7a8c;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-light: #dbeafe;
  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --transition: 0.2s ease;
}

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* === Typography === */
h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--color-text);
}

h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  margin-top: 2.5rem;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}

h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

p {
  color: var(--color-text-secondary);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent-hover);
}

ul {
  list-style: none;
  margin-left: 0;
}

li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.5;
}

li strong {
  color: var(--color-text);
  font-weight: 600;
}

/* === Header === */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.header-content {
  flex: 1;
}

.tagline {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.contact {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.contact-text {
  display: flex;
  align-items: center;
}

.contact-links {
  display: flex;
  align-items: center;
}

.contact a {
  color: var(--color-text-secondary);
}

.contact a:hover {
  color: var(--color-accent);
}

.separator {
  color: var(--color-border);
  margin: 0 0.35rem;
}

/* Icon styles */
.link-icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  max-width: 1.1rem;
  max-height: 1.1rem;
  flex-shrink: 0;
}

.link-text {
  display: none;
}

.contact-link {
  display: flex;
  align-items: center;
}

.desktop-only {
  display: inline;
}

/* Print-only elements hidden on web */
.print-only {
  display: none;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-text);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.download-btn:hover {
  background: var(--color-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.download-icon {
  font-size: 1rem;
}

/* === Summary === */
.summary {
  background: linear-gradient(135deg, var(--color-accent-light) 0%, #f0f7ff 100%);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--color-accent);
}

.summary p {
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.7;
  margin: 0;
}

/* === Experience Section === */
#experience h2 {
  margin-top: 2rem;
}

/* === Job Cards (Accordion) === */
.job {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: all var(--transition);
}

.job:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-sm);
}

.job-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  gap: 1rem;
}

.job-header:hover {
  background: var(--color-bg);
}

.job-title {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.job-title h3 {
  margin: 0;
}

.job-title .role {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.job-meta {
  text-align: right;
  flex-shrink: 0;
}

.job-meta .dates {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: block;
}

.job-meta .location {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Job Preview - visible when collapsed */
.job-preview {
  width: 100%;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0.5rem 0 0 0;
  line-height: 1.5;
  order: 10; /* Push to end of flex container */
}

.accordion-trigger[aria-expanded="true"] .job-preview {
  display: none;
}

/* Accordion Icon */
.accordion-icon {
  width: 20px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
}

.accordion-icon::before,
.accordion-icon::after {
  content: "";
  position: absolute;
  background: var(--color-text-muted);
  transition: transform var(--transition);
}

.accordion-icon::before {
  width: 12px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.accordion-icon::after {
  width: 2px;
  height: 12px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.accordion-trigger[aria-expanded="true"] .accordion-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
  opacity: 0;
}

/* Accordion Content */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1.25rem;
}

.accordion-trigger[aria-expanded="true"] + .accordion-content {
  padding-bottom: 1.25rem;
}

.job-summary {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
  font-style: italic;
}

/* Subroles within Google */
.subrole {
  margin-bottom: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--color-border);
}

.subrole:first-child {
  border-top: none;
  padding-top: 0;
}

.subrole h4 {
  margin-bottom: 0.25rem;
}

.subrole .job-summary {
  margin-bottom: 0.5rem;
}

.subrole ul {
  margin-bottom: 0;
}

/* === Publications === */
.publication {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.publication h3 {
  font-size: 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.pub-year {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.publication p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.pub-link {
  font-size: 0.85rem;
  font-weight: 500;
}

/* === Education === */
.education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
}

.education-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.education-item h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.education-item p {
  font-size: 0.9rem;
  margin: 0;
}

/* === Projects === */
.project {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.project h3 {
  font-size: 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.project-tag {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.project p {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.project-links {
  display: flex;
  gap: 1rem;
}

.project-links a {
  font-size: 0.85rem;
  font-weight: 500;
}

/* === Interests === */
.interests-list {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* === Responsive === */
@media (max-width: 640px) {
  .container {
    padding: 1.25rem 1rem 3rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 1rem;
  }

  .header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .tagline {
    margin-bottom: 0.5rem;
  }

  .contact {
    flex-direction: column;
    gap: 0.5rem;
  }

  .contact-text {
    justify-content: center;
  }

  .contact-links {
    gap: 1rem;
    justify-content: center;
  }

  .desktop-only {
    display: none;
  }

  .contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    transition: all var(--transition);
  }

  .contact-link:hover {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
  }

  .download-btn {
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
  }

  .job-header {
    position: relative;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .job-meta {
    text-align: left;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
  }

  .accordion-icon {
    position: absolute;
    right: 1rem;
    top: 1rem;
  }

  .job-title {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* === Print Styles === */
@media print {
  /* Reset all colors to black/white */
  * {
    color: #000 !important;
    background: white !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html {
    font-size: 8.5pt;
  }

  body {
    line-height: 1.35;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  /* Hide non-essential elements */
  .download-btn,
  .accordion-icon,
  .job-preview {
    display: none !important;
  }

  /* === Header === */
  header {
    display: block;
    padding-bottom: 0.2rem;
    margin-bottom: 0.2rem;
    border-bottom: 1.5pt solid #000;
  }

  h1 {
    font-size: 16pt;
    margin-bottom: 0;
    text-align: center;
  }

  .tagline {
    display: none; /* Save space - title is in the content */
  }

  .contact {
    font-size: 9pt;
    text-align: center;
    margin-top: 0.15rem;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .contact-text,
  .contact-links {
    display: inline;
  }

  .separator {
    margin: 0 0.3rem;
  }

  .desktop-only {
    display: inline !important;
  }

  .link-text {
    display: inline !important;
  }

  .link-icon {
    display: none !important;
  }

  .contact-link {
    display: inline !important;
    background: transparent !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
  }

  /* Show print-only elements */
  .print-only {
    display: inline !important;
  }

  /* Show URLs for contact links */
  .contact-link {
    /* Replace link text with URL */
  }

  .contact-link[href*="github.com"]::after {
    content: none;
  }

  .contact-link[href*="linkedin.com"]::after {
    content: none;
  }

  /* Style the portfolio link */
  .portfolio-link {
    font-weight: 500;
  }

  /* === Summary === */
  .summary {
    border: none;
    border-left: none;
    padding: 0.2rem 0;
    margin-bottom: 0.15rem;
  }

  .summary p {
    font-size: 9pt;
    line-height: 1.4;
  }

  /* === Section Headers === */
  h2 {
    font-size: 10pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 0.5pt solid #000;
    padding-bottom: 0.1rem;
    margin-top: 0.4rem;
    margin-bottom: 0.2rem;
  }

  #experience h2 {
    margin-top: 0.25rem;
  }

  /* === Jobs === */
  .job {
    border: none;
    margin-bottom: 0;
    padding: 0;
    padding-top: 0.4rem;
    margin-top: 0.8rem;
    border-top: 0.5pt solid #bbb;
  }

  .job:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .job-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0;
    margin-bottom: 0.15rem;
    cursor: default;
  }

  .job-title {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
  }

  .job-title h3 {
    font-size: 10pt;
    font-weight: 700;
  }

  .job-title .role {
    font-size: 9pt;
    font-weight: 400;
    font-style: italic;
  }

  .job-meta {
    display: flex;
    align-items: baseline;
    text-align: right;
    white-space: nowrap;
  }

  .job-meta .dates {
    font-size: 9pt;
    font-weight: 600;
  }

  .job-meta .location {
    font-size: 8pt;
  }

  .job-meta .location::before {
    content: " · ";
  }

  /* Expand all accordions */
  .accordion-content {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .job-summary {
    font-size: 9pt;
    font-style: italic;
    margin-bottom: 0.15rem;
  }

  /* === Subroles (Google) === */
  .subrole {
    margin-bottom: 0;
    margin-top: 0.25rem;
    padding-top: 0;
    border-top: none;
  }

  .subrole:first-child {
    margin-top: 0.1rem;
  }

  .subrole h4 {
    font-size: 9pt;
    font-weight: 600;
    font-style: italic;
    margin-bottom: 0.05rem;
  }

  .subrole .job-summary {
    margin-bottom: 0.1rem;
  }

  /* === Lists === */
  ul {
    margin: 0;
    padding-left: 0;
  }

  ul:last-child {
    margin-bottom: 0;
  }

  li {
    font-size: 9pt;
    margin-bottom: 0.08rem;
    padding-left: 0.9rem;
    line-height: 1.35;
  }

  li:last-child {
    margin-bottom: 0;
  }

  li::before {
    width: 3px;
    height: 3px;
    top: 0.5em;
    background: #000 !important;
    opacity: 1;
  }

  li strong {
    font-weight: 600;
  }

  /* === Publications === */
  .publication {
    border: none;
    padding: 0;
    margin-bottom: 0.2rem;
  }

  .publication h3 {
    font-size: 9pt;
    font-weight: 600;
    margin-bottom: 0.05rem;
  }

  .pub-year {
    font-weight: 400;
  }

  .publication p {
    font-size: 8.5pt;
    margin-bottom: 0.05rem;
  }

  .pub-link {
    font-size: 8pt;
  }

  /* === Education === */
  .education-grid {
    display: block;
  }

  .education-item {
    border: none;
    padding: 0;
    margin-bottom: 0.15rem;
  }

  .education-item h3 {
    font-size: 9pt;
    font-weight: 600;
    display: inline;
  }

  .education-item p {
    font-size: 9pt;
    display: inline;
    margin: 0;
  }

  .education-item p::before {
    content: " — ";
  }

  /* === Projects === */
  .project {
    border: none;
    padding: 0;
    margin-bottom: 0.15rem;
  }

  .project h3 {
    font-size: 9pt;
    font-weight: 600;
    margin-bottom: 0.05rem;
  }

  .project-tag {
    font-size: 7pt;
    background: transparent !important;
    padding: 0;
  }

  .project p {
    font-size: 8.5pt;
    margin-bottom: 0.1rem;
  }

  .project-links {
    font-size: 8pt;
  }

  .project-links a {
    margin-right: 0.75rem;
  }

  /* === Interests === */
  #interests h2 {
    margin-top: 0.3rem;
  }

  .interests-list {
    font-size: 9pt;
  }

  /* === Links - show URLs only for key links === */
  a {
    text-decoration: none;
  }

  /* Don't show URLs by default - too cluttered */
  a[href]::after {
    content: none;
  }

  /* Show URLs only for publication/project links */
  .pub-link::after,
  .project-links a::after {
    content: " [" attr(href) "]";
    font-size: 7pt;
    word-break: break-all;
  }

  /* === Page Setup === */
  @page {
    margin: 0.5in;
    size: letter;
  }

  /* Avoid bad page breaks */
  h2, h3, h4 {
    page-break-after: avoid;
  }

  .job {
    page-break-inside: avoid;
  }

  .subrole {
    page-break-inside: avoid;
  }
}
