/* Global CSS for personal website */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --color-bg: #ffffff;
  --color-bg-rgb: 255,255,255;
  --color-text: #1f1f1f;
  --color-accent: #6366f1;
  --color-accent-rgb: 99,102,241;
  --color-border: #e2e8f0;
  --color-muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --transition: 0.25s cubic-bezier(.4,.0,.2,1);
}
.dark {
  --color-bg: #0f1115;
  --color-bg-rgb: 15,17,21;
  --color-text: #f1f5f9;
  --color-border: #1e293b;
  --color-muted: #94a3b8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--color-accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: rgba(var(--color-bg-rgb),0.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  z-index: 20;
}
.logo {
  font-weight: 700;
  letter-spacing: .4px;
  font-size: 1rem;
  background: linear-gradient(90deg,var(--color-accent) 0%, #4f46e5 40%, #9333ea 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.nav__toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  padding: .35rem .6rem;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
}
.nav__menu { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; }
.nav__menu a, .theme-toggle {
  padding: .45rem .75rem;
  border-radius: var(--radius-sm);
  line-height: 1.2;
  position: relative;
  font-size: .82rem;
  font-weight: 500;
}
.nav__menu a::after {
  content:"";
  position:absolute; left:.55rem; right:.55rem; bottom:0.35rem;
  height:2px; border-radius:2px;
  background: linear-gradient(90deg,var(--color-accent) 0%, #4f46e5 70%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  opacity:.75;
}
.nav__menu a:hover::after, .nav__menu a:focus::after { transform: scaleX(1); }
.nav__menu a[aria-current="page"] { color: var(--color-accent); font-weight:600; }
.nav__menu a[aria-current="page"]::after { transform: scaleX(1); }
.theme-toggle { border: 1px solid var(--color-border); background: none; cursor: pointer; }
.theme-toggle:hover { background: rgba(var(--color-accent-rgb), .08); }

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 2.5rem;
  padding: 4.5rem 1.25rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}
.hero__content h1 { font-size: clamp(2.2rem, 6vw, 3.2rem); margin: 0 0 .75rem; }
.subtitle { font-size: 1.1rem; color: var(--color-muted); margin-bottom: 1.5rem; }
.accent { color: var(--color-accent); position: relative; }
.btn {
  display: inline-block;
  font-weight: 600;
  padding: .75rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.btn:hover { filter: brightness(1.1); }
.btn.primary { background: linear-gradient(135deg,var(--color-accent) 0%, #4f46e5 100%); }

.section { padding: 3.5rem 1.25rem; }
.section:nth-of-type(even) { background: linear-gradient(to bottom,var(--color-bg),rgba(var(--color-accent-rgb),0.05)); }
.section__inner { max-width: 1100px; margin: 0 auto; }
.section h2 { font-size: 2rem; margin-top: 0; }
.details { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .5rem; }
.details li { background: rgba(var(--color-accent-rgb),0.06); padding: .5rem .75rem; border-radius: var(--radius-sm); }
.dark .details li { background: rgba(var(--color-accent-rgb),0.15); }

.projects__grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
}
.project {
  padding: 1rem 1rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; gap: .4rem;
  background: rgba(var(--color-accent-rgb),0.03);
  transition: var(--transition);
}
.project:hover { border-color: var(--color-accent); transform: translateY(-4px); }
.project__link { font-size: .875rem; font-weight: 600; }
/* Professional Highlights compact refinements */
.highlights .project { padding: .85rem .9rem 1rem; gap: .35rem; }
.highlights .project h3 { font-size: 1.05rem; margin: .25rem 0 .35rem; letter-spacing:.3px; }
.highlights .project p { font-size: .78rem; line-height:1.4; }
.highlights .project ul.list-compact, .highlights .project ol.list-compact { font-size: .78rem; line-height:1.4; }
.highlights .project ul.list-compact li, .highlights .project ol.list-compact li { margin: 0 0 .3rem; }
.highlights .projects__grid { gap: 1.25rem; }
@media (min-width: 980px){
  .highlights .projects__grid { grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); }
}
/* Slightly subtler background to reduce perceived size */
.highlights .project { background: rgba(var(--color-accent-rgb),0.025); }
.dark .highlights .project { background: rgba(var(--color-accent-rgb),0.11); }
/* Equal height cards and icon headings */
.highlights .projects__grid { align-items: stretch; }
.highlights .hl-card { display:flex; flex-direction:column; }
.highlights .hl-card h3 { position:relative; padding-left:1.9rem; }
.highlights .hl-card h3::before {
  content:"";
  position:absolute; left:0; top:.15rem;
  width:1.3rem; height:1.3rem;
  background: currentColor;
  opacity:.85;
  -webkit-mask-size:contain; -webkit-mask-repeat:no-repeat; -webkit-mask-position:center;
  mask-size:contain; mask-repeat:no-repeat; mask-position:center;
}
/* Icon variants using CSS masks (data URI inline SVG) */
.hl-card[data-icon="grid"] h3::before { mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M3 3h8v8H3V3zm10 0h8v8h-8V3zM3 13h8v8H3v-8zm10 8v-8h8v8h-8z'/></svg>"); }
.hl-card[data-icon="layers"] h3::before { mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M12 2l9 5-9 5-9-5 9-5zm0 7l9 5-9 5-9-5 9-5zm0 7l9 5-9 5-9-5 9-5z'/></svg>"); }
.hl-card[data-icon="route"] h3::before { mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M6 3a3 3 0 0 1 3 3v9a3 3 0 1 0 6 0V6a3 3 0 1 1 3 3H16a1 1 0 0 0-2 0v6a1 1 0 1 1-2 0V6A3 3 0 0 0 6 3z'/></svg>"); }
.hl-card[data-icon="chart"] h3::before { mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M3 21V3h2v16h3V8h2v11h3v-7h2v7h3v-4h2v4H3z'/></svg>"); }
.hl-card[data-icon="radar"] h3::before { mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M12 2 4 7v10l8 5 8-5V7l-8-5zm0 2.2 5.8 3.6v6.4L12 17.8 6.2 14V7.8L12 4.2z'/></svg>"); }
.hl-card[data-icon="document"] h3::before { mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M6 2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.1.9-2 2-2zm8 7V3.5L18.5 9H14z'/></svg>"); }
/* List item separators for compact lists */
.highlights .hl-card ul.list-compact li+li, .highlights .hl-card ol.list-compact li+li {
  border-top:1px solid rgba(var(--color-accent-rgb),0.15);
  padding-top:.35rem;
}
.dark .highlights .hl-card ul.list-compact li+li, .dark .highlights .hl-card ol.list-compact li+li {
  border-top:1px solid rgba(var(--color-accent-rgb),0.35);
}
/* Hover accent */
.highlights .hl-card { transition: box-shadow var(--transition), transform var(--transition), background-color var(--transition); }
.highlights .hl-card:hover { box-shadow:0 4px 14px rgba(0,0,0,.12); background: rgba(var(--color-accent-rgb),0.05); transform:translateY(-3px); }
.dark .highlights .hl-card:hover { background: rgba(var(--color-accent-rgb),0.18); }
/* Expandable list support */
.hl-card .list-compact li.is-hidden { display:none; }
.hl-card .toggle-more { margin-top:.35rem; align-self:flex-start; font-size:.7rem; font-weight:600; background:none; border:1px solid var(--color-border); padding:.35rem .55rem; border-radius:var(--radius-sm); cursor:pointer; color:var(--color-accent); }
.hl-card .toggle-more:hover { background:rgba(var(--color-accent-rgb),0.08); }
.dark .hl-card .toggle-more:hover { background:rgba(var(--color-accent-rgb),0.25); }
/* Print refinements */
@media print {
  .highlights .projects__grid { display:block; }
  .highlights .hl-card { page-break-inside:avoid; box-shadow:none !important; border:1px solid #999; margin:0 0 .75rem; }
  .highlights .hl-card h3 { padding-left:0; }
  .highlights .hl-card h3::before { display:none !important; }
  .hl-card .list-compact li.is-hidden { display:list-item !important; }
  .hl-card .toggle-more { display:none !important; }
}

.contact form { display: grid; gap: 1rem; max-width: 620px; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
input, textarea {
  font: inherit;
  padding: .65rem .75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
}
input:focus, textarea:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.error { color: #dc2626; font-size: .75rem; min-height: .75rem; }
#formStatus { font-size: .875rem; margin-top: .25rem; }
/* Spinner */
.btn .spinner { display:inline-block; width:16px; height:16px; vertical-align:middle; margin-left:.5rem; border:2px solid rgba(var(--color-accent-rgb),0.35); border-top-color: var(--color-accent); border-radius:50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-footer {
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: .875rem;
}
.social { list-style: none; display: flex; gap: 1rem; justify-content: center; padding: 0; margin: 1rem 0 0; }
.social a { font-size: .85rem; }

/* Responsive nav */
@media (max-width: 780px) {
  .nav__toggle { display: inline-block; }
  .nav__menu { position: absolute; top: 100%; right: .75rem; background: var(--color-bg); flex-direction: column; padding: .75rem; border: 1px solid var(--color-border); border-radius: var(--radius-md); min-width: 180px; box-shadow: var(--shadow-sm); display: none; }
  .nav__menu.open { display: flex; }
}

/* Dark mode transitions */
body, body * { transition: background-color var(--transition), color var(--transition), border-color var(--transition); }
/* Additional subtle transitions */
.nav__menu a, .logo { transition: color var(--transition), background var(--transition); }

/* Utility */
.visually-hidden { position: absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); border:0; }

/* Layout Utilities */
.container, .section__inner { max-width: 1100px; margin: 0 auto; }
.mt-sm { margin-top: .25rem !important; }
.mt-md { margin-top: 1rem !important; }
.mt-lg { margin-top: 1.75rem !important; }
.center { text-align: center; }
.list-compact { margin:0; padding-left:1.1rem; font-size:.82rem; line-height:1.45; }
.cards-grid { display:grid; gap:1.5rem; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); }
.card-min { min-height:auto; }
.btn + .btn { margin-left:.5rem; }
.headshot {
  /* Responsive circular crop using a configurable size token */
  --hs-size: clamp(160px, 22vw, 240px);
  width: var(--hs-size);
  height: var(--hs-size);
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 4px solid var(--color-border);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  background: #fff;
  aspect-ratio: 1 / 1; /* Ensures square box for layout calculations */
  overflow: hidden;
}
/* Positioning variants to reveal more of the top (avoid cutting hair/forehead) */
.headshot.headshot--top { object-position: center top; }
/* Slight upward shift (useful if top is just slightly cropped) */
.headshot.headshot--shift-up { object-position: 50% 20%; }
/* Provide a version that fits entire image (may introduce letterboxing inside circle) */
.headshot.headshot--contain { object-fit: contain; background: #fff; }
/* Optional size variants */
.headshot.headshot--sm { --hs-size: 120px; }
.headshot.headshot--lg { --hs-size: 320px; }
/* Legacy small-screen override retained for browsers without clamp support */
@media (max-width: 520px){ .headshot { --hs-size: 180px; } }

/* Typography enhancements */
h1, h2, h3 { line-height:1.15; }
p { max-width: 900px; }

/* Responsive refinements */
@media (max-width: 520px) {
  .hero { padding:3rem 1rem 2.5rem; }
  .section { padding:2.75rem 1rem; }
  .subtitle { font-size:1rem; }
  h2 { font-size:1.75rem; }
}
@media (min-width: 1200px) {
  .hero, .section__inner { max-width: 1180px; }
}

/* Focus & accessibility improvements */
a:focus-visible, button:focus-visible { outline:2px solid var(--color-accent); outline-offset:2px; }

/* Print adjustments (basic) */
@media print {
  /* Hide interactive chrome & action buttons */
  .site-header, .site-footer, .nav__toggle, .theme-toggle, .toggle-legacy, #printResume, .resume__header .btn { display:none !important; }
  body { color:#000; background:#fff; }
  a { text-decoration:underline; }
  .project, .details li { box-shadow:none; border-color:#999; }
  .resume .section__inner { max-width: 100%; }
  .skills-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  details.legacy-projects { page-break-inside: avoid; }
}

/* Resume specific layout */
.resume .resume__header { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
.resume .skills-grid { display:grid; gap:1.25rem; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); margin:1rem 0 1.25rem; }
.legacy-stack { padding:.75rem .85rem; border:1px dashed var(--color-border); border-radius: var(--radius-sm); background: rgba(var(--color-accent-rgb),0.05); }
.legacy-stack[hidden] { display:none !important; }
details.legacy-projects { margin-top:1.25rem; }
details.legacy-projects summary { cursor:pointer; font-weight:600; }
details.legacy-projects summary::-webkit-details-marker { display:none; }
details.legacy-projects summary:after { content:'▼'; font-size:.65rem; margin-left:.5rem; transition:transform .3s; }
details.legacy-projects[open] summary:after { transform:rotate(180deg); }
.btn.small { padding:.45rem .75rem; font-size:.7rem; }
