/* Personal site styles. Imports tokens from colors_and_type.css */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.65;
  min-height: 100vh;
  transition: background-color 280ms var(--ease-in-out), color 280ms var(--ease-in-out);
}

/* Sage bullet points everywhere */
ul li::marker { color: var(--accent-sage); }
ul li { padding-left: 4px; }
a { color: inherit; text-decoration: none; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 32px; }
.container.narrow { max-width: 720px; margin-left: max(0px, calc((100vw - 1080px) / 2)); margin-right: auto; padding: 0 32px; }

.section { padding: var(--space-10) 0 42px; position: relative; }
.section + .section { border-top: 1px solid var(--border-0); }
.hero + .section { border-top: 1px solid var(--border-0); }

@media (max-width: 768px) {
  .section { padding: 26px 0; }
  .container { padding: 0 20px; }
  .container.narrow { padding: 0 20px; }
}

/* ---------- Eyebrow ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: 500;
  margin-bottom: var(--space-6);
  display: block;
}
.eyebrow-dot {
  color: #C8D6CB;
  letter-spacing: 0;
  font-size: 22px;
  vertical-align: middle;
  line-height: 1;
  margin: 0 -7px;
  position: relative;
  top: -1px;
}

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out); }
.reveal.in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: color-mix(in oklab, var(--bg-0) 72%, transparent);
  border-bottom: 1px solid var(--border-0);
}
.nav .logo { font-size: 18px; font-weight: 600; letter-spacing: -0.04em; color: var(--fg-0); transition: color 160ms var(--ease-out); }
.nav .logo .logo-dot { color: var(--accent-sage); transition: color 160ms var(--ease-out); }
.nav .logo:hover { color: var(--accent-sage); }
.nav .logo:hover .logo-dot { color: var(--accent-sage); }
.nav .links { display: flex; gap: 22px; }
.nav .links a { font-size: 14px; color: var(--fg-1); transition: color 160ms var(--ease-out); position: relative; }
.nav .links a:hover { color: var(--accent-sage); }
.nav .links a.active { color: var(--fg-0); }
.nav .links a.active:after { content:''; position:absolute; left:0; right:0; bottom:-6px; height:1.5px; background: var(--accent-sage); }
.nav .toggle {
  display: flex; align-items: center; gap: 3px;
  padding: 4px 2px;
  border: none; border-radius: 0;
  background: transparent; cursor: pointer; color: var(--fg-1);
  transition: color 160ms var(--ease-out);
}
.nav .toggle:hover { color: #7A9B7E; background: transparent; }
.nav .toggle-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  transition: opacity 160ms var(--ease-out);
  line-height: 1;
}
.nav .toggle-icon { display: flex; align-items: center; line-height: 0; opacity: 0.91; }
.nav .toggle:hover .toggle-icon { opacity: 0.99; }
.nav .toggle svg { width: 20px; height: 20px; }
/* Hamburger button — hidden on desktop */
.nav-ham {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; width: 28px; height: 28px;
  background: none; border: none; cursor: pointer;
  color: var(--fg-0); padding: 0; flex: none;
}
.nav-ham .hd {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--fg-0); opacity: 0.85;
  transition: transform 320ms cubic-bezier(0.22,0.61,0.36,1), opacity 200ms, width 320ms cubic-bezier(0.22,0.61,0.36,1), border-radius 220ms;
}
.nav-ham.open .hd { opacity: 1; }
.nav-ham.open .hd:nth-child(1) { transform: translateY(5px) rotate(45deg); width: 14px; border-radius: 2px; }
.nav-ham.open .hd:nth-child(2) { opacity: 0; width: 0; }
.nav-ham.open .hd:nth-child(3) { transform: translateY(-5px) rotate(-45deg); width: 14px; border-radius: 2px; }

/* Mobile backdrop — blurs the page behind the card */
.mobile-backdrop {
  position: fixed; inset: 0; z-index: 28;
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  background: rgba(0,0,0,0.15);
  animation: backdropIn 320ms ease forwards;
}
.mobile-backdrop.closing {
  /* backdrop fades AFTER card has slid out */
  animation: backdropOut 200ms 380ms ease forwards;
}
@keyframes backdropIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdropOut { from { opacity: 1; } to { opacity: 0; } }

/* Mobile menu card */
.mobile-menu {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 300px; max-width: 85vw;
  padding-top: 49px;
  display: flex; flex-direction: column;
  background: var(--bg-0);
  box-shadow: 3px 0 20px rgba(0,0,0,0.07);
  border-radius: 0 10px 10px 0;
  border-right: 1px solid var(--border-0);
  animation: mobileMenuIn 440ms cubic-bezier(0.34,1.05,0.64,1) forwards;
}
.mobile-backdrop.closing .mobile-menu {
  animation: mobileMenuOut 360ms cubic-bezier(0.65,0,1,0.5) forwards;
}
.mobile-backdrop.closing .mobile-menu-links a {
  animation: mobileItemOut 160ms cubic-bezier(0.65,0,1,0.5) forwards !important;
}
@keyframes mobileMenuIn  { from { transform: translateX(-110%); opacity: 0.4; } to { transform: translateX(0); opacity: 1; } }
@keyframes mobileMenuOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(-115%); opacity: 0.2; } }
@keyframes mobileItemIn  { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes mobileItemOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-24px); } }

.mobile-menu-links {
  display: flex; flex-direction: column;
  padding: 20px 24px 0;
}
.mobile-menu-links a {
  font-family: var(--font-sans);
  font-size: clamp(15px, 4vw, 18px); font-weight: 400; letter-spacing: -0.01em;
  color: var(--fg-1); text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-0);
  opacity: 0;
  animation: mobileItemIn 260ms cubic-bezier(0.22,0.61,0.36,1) forwards;
  transition: color 160ms var(--ease-out);
}
.mobile-menu-links a.active, .mobile-menu-links a:hover { color: var(--accent-sage); }
.mobile-menu-toggle-row {
  padding: 18px 0 10px;
  display: flex; justify-content: center;
}
.mobile-menu-extras {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}
.mobile-toggle {
  background: transparent; border: none; cursor: pointer;
  color: var(--fg-1); display: flex; align-items: center; gap: 6px;
}
.mobile-toggle:hover { color: var(--accent-sage); }
.mobile-menu-logo {
  font-family: var(--font-sans);
  font-size: 44px; font-weight: 600; letter-spacing: -0.04em;
  color: var(--fg-0); line-height: 1;
}
.mobile-menu-logo .logo-dot { color: var(--accent-sage); }

/* Mobile nav layout */
@media (max-width: 768px) {
  .nav {
    display: grid;
    grid-template-columns: 28px 1fr 28px;
    gap: 8px; padding: 12px 20px 12px 12px;
  }
  .nav .logo { text-align: center; }
  .nav .links { display: none; }
  .nav .toggle { display: none; }
  .nav-ham { display: flex; }
}

/* ---------- Hero ---------- */
.hero { padding-top: 62px; padding-bottom: var(--space-20); position: relative; }
@media (max-width: 768px) { .hero { padding-top: 28px; padding-bottom: var(--space-6); } }
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: start; }
.hero h1 { font-family: var(--font-sans); font-size: clamp(44px, 6.5vw, 88px); line-height: 0.95; letter-spacing: -0.025em; font-weight: 700; color: var(--fg-0); margin: 0 0 24px; max-width: 14ch; }
.hero h1 em { font-style: normal; font-weight: 600; color: var(--accent-navy); }
.gradient-accent {
  color: #7A9B7E;
  font-style: normal;
  font-weight: 700;
}
.rocksalt-accent {
  font-family: var(--font-accent);
  font-size: 0.62em;
  color: var(--accent-sage);
  vertical-align: middle;
  letter-spacing: 0.01em;
}
.hero .lead { font-size: clamp(18px, 1.5vw, 22px); line-height: 1.5; color: var(--fg-1); max-width: 560px; margin: 0 0 32px; }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; }
/* Desktop portrait — right column */
.hero-portrait-desktop { display: block; opacity: 0; animation: portraitFadeIn 900ms 400ms var(--ease-out) forwards; }
.hero-portrait-mobile { display: none; margin: 16px 0 24px; opacity: 0; animation: portraitFadeIn 800ms 200ms var(--ease-out) forwards; }
@keyframes portraitFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-portrait-desktop { display: none; }
  .hero-portrait-mobile { display: block; }
  .hero .portrait-wrap { width: 160px; height: 160px; }
}
@media (max-width: 768px) {
  .hero h1 { font-size: clamp(32px, 9vw, 48px); }
  .hero .lead { font-size: 16px; }
  .hero .ctas { flex-direction: column; align-items: flex-start; }
  .hero .portrait-wrap { width: 180px; height: 180px; }
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-sans); font-size: 15px; font-weight: 500;
  border: none; cursor: pointer;
  padding: 12px 20px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 160ms var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--fg-0); color: var(--bg-0); }
.btn-primary:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98) translateY(-1px); }
.btn-ghost { background: transparent; color: var(--fg-0); border: 1px solid var(--border-1); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-cv { background: #C8D6CB; color: #15202B; border: none; text-decoration: none; }
.btn-cv:hover { background: #7A9B7E; color: #FFFFFF; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-cv:active { transform: scale(0.98); }
.btn-cv .arrow { transition: transform 200ms var(--ease-out); }
.btn-cv:hover .arrow { transform: translateY(2px); }
.btn .arrow { font-size: 16px; line-height: 1; transition: transform 200ms var(--ease-out); }
.btn:hover .arrow { transform: translateX(2px); }

/* ---------- Portrait ---------- */
.portrait-wrap { width: 220px; height: 220px; flex: none; position: relative; }
.portrait-wrap.sm { width: 140px; height: 140px; }
.portrait-ring {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--accent-sage);
  padding: 3px;
}
.portrait-inner { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--bg-0); }
.portrait-inner img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .portrait-ring { animation: none; } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.about-grid h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; color: var(--fg-0); margin: 0 0 24px; }
.about-grid h2 em { font-style: normal; font-weight: 700; color: var(--accent-navy); }
.about-grid p { font-size: 16px; line-height: 1.7; color: var(--fg-1); margin: 0 0 16px; max-width: 50ch; }
.about-grid p strong { font-weight: 600; color: var(--fg-0); }
.about-grid p em { font-family: var(--font-serif); font-style: italic; }
@media (max-width: 768px) { .about-grid { grid-template-columns: 1fr; gap: 32px; } }

/* ---------- Projects ---------- */
.projects h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; color: var(--fg-0); margin: 0 0 8px; }
.projects .subtitle { color: var(--fg-1); font-size: 16px; line-height: 1.7; margin: 0 0 32px; font-weight: 400; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; }
.pill {
  font-size: 13px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border-1); color: var(--fg-1); background: transparent;
  cursor: pointer; font-family: var(--font-sans);
  transition: all 160ms var(--ease-out);
}
.pill:hover { background: var(--bg-2); }
.pill.active { background: var(--fg-0); color: var(--bg-0); border-color: var(--fg-0); }
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (max-width: 768px) { .proj-grid { grid-template-columns: 1fr; } .proj { height: auto; min-height: 240px; } }

/* Flip card */
.proj {
  perspective: 1000px;
  height: 380px;
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: 14px;
  box-shadow: none;
  padding: 0;
}
.proj:hover { transform: none; box-shadow: none; border-color: transparent; }
.proj-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 560ms cubic-bezier(0.34, 1.1, 0.64, 1);
  border-radius: 14px;
}
.proj:hover .proj-inner { transform: translateY(-6px); }
.proj.flipped:hover .proj-inner { transform: rotateY(180deg) translateY(-6px); }
@media (max-width: 768px) {
  .proj:hover .proj-inner { transform: none; }
  .proj.flipped:hover .proj-inner { transform: rotateY(180deg); }
}

.proj-front, .proj-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  border: 1px solid var(--border-0);
  background: var(--bg-1);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  overflow: hidden;
}
.proj-front { z-index: 2; }
.proj-back {
  transform: rotateY(180deg);
  background: var(--bg-1);
  display: flex; flex-direction: column; gap: 10px;
  justify-content: flex-start;
}
.proj-back .back-meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3); }
.proj-back .back-title { font-size: 16px; font-weight: 600; color: var(--fg-0); letter-spacing: -0.01em; margin: 0; }
.proj-back .back-role { font-family: var(--font-mono); font-size: 11px; color: var(--accent-sage); letter-spacing: 0.06em; margin: 0; }
.proj-back .back-body { font-size: 14px; color: var(--fg-2); line-height: 1.6; margin: 0; flex: 1; overflow: hidden; }
.proj-back .back-hint { font-family: var(--font-mono); font-size: 10px; color: var(--fg-4); letter-spacing: 0.1em; text-transform: uppercase; margin-top: auto; }

/* Flip hint overlay on card thumbnail */
.proj-flip-hint { display: none; }
.proj:hover .proj-thumb-img { opacity: 1 !important; }
.proj .thumb-img { overflow: hidden; position: relative; aspect-ratio: 16/9; border-radius: 10px; flex-shrink: 0; }
.proj .meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-2); }
.proj .title { font-size: 16px; font-weight: 600; color: var(--fg-0); letter-spacing: -0.01em; margin: 0; }
.proj .desc { font-size: 13px; color: var(--fg-2); line-height: 1.55; margin: 0; }

/* ---------- Now ---------- */
.now h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; color: var(--fg-0); margin: 0 0 8px; }
.now .subtitle { color: var(--fg-1); font-size: 16px; line-height: 1.7; margin: 0 0 24px; font-weight: 400; }
.now-row { display: grid; grid-template-columns: 140px 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--border-0); align-items: baseline; }
.now-row:last-child { border-bottom: none; }
.now-row .date { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3); }
.now-row .text { font-size: 16px; color: var(--fg-1); line-height: 1.6; }
.now-row .text em { font-style: normal; font-weight: 600; color: var(--fg-0); }
@media (max-width: 768px) {
  .now-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- Resume ---------- */
.resume h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; color: var(--fg-0); margin: 0 0 24px; }
.role { display: grid; grid-template-columns: 160px 1fr; gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--border-0); }
.role:last-child { border-bottom: none; }
.role .when { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3); padding-top: 4px; }
.role h3 { font-size: 18px; font-weight: 600; color: var(--fg-0); margin: 0 0 4px; letter-spacing: -0.01em; }
.role .company { font-size: 14px; color: var(--fg-2); margin: 0 0 10px; }
.role ul { margin: 0; padding-left: 18px; color: var(--fg-1); font-size: 14px; line-height: 1.7; }
.role ul li { margin-bottom: 4px; }
@media (max-width: 768px) { .role { grid-template-columns: 1fr; gap: 4px; } .role .when { padding-top: 0; } }

/* ---------- Contact ---------- */
.contact h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; color: var(--fg-0); margin: 0 0 16px; }
.contact .lead { font-size: 16px; line-height: 1.7; color: var(--fg-1); margin: 0 0 32px; font-weight: 400; }
.contact-list { display: flex; flex-direction: column; }
.contact-row {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border-0);
  align-items: center;
  transition: padding 160ms var(--ease-out);
  text-decoration: none;
}
.contact-row .icon { display: flex; align-items: center; justify-content: center; }
.contact-row:hover { padding-left: 12px; }
.contact-row .icon { color: var(--fg-2); transition: color 160ms; }
.contact-row:hover .icon { color: var(--accent-sage); }
.contact-row .label { font-size: clamp(13px, 1.3vw, 17px); font-weight: 500; letter-spacing: -0.01em; color: var(--fg-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-row .arrow { color: var(--fg-3); transition: transform 200ms; flex: none; }
.contact-row:hover .label { color: var(--accent-sage); }
.contact-row:hover .icon { color: var(--accent-sage); }
.contact-row:hover .arrow { transform: translate(4px, -4px); color: var(--accent-sage); }
/* ServiceNow PNG icon — filter to currentColor */
.icon-img-sn { filter: brightness(0) opacity(0.55); transition: filter 160ms var(--ease-out); }
.contact-row:hover .icon-img-sn { filter: invert(62%) sepia(14%) saturate(621%) hue-rotate(93deg) brightness(88%) contrast(87%); }
[data-theme="dark"] .icon-img-sn { filter: brightness(0) invert(1) opacity(0.65); }
[data-theme="dark"] .contact-row:hover .icon-img-sn { filter: invert(80%) sepia(14%) saturate(400%) hue-rotate(93deg) brightness(120%); }

/* ---------- Footer ---------- */
.site-footer { padding: var(--space-6) 32px; color: var(--fg-3); font-size: 13px; display: flex; justify-content: space-between; align-items: center; width: 100%; box-sizing: border-box; }
.footer-logo { font-family: var(--font-sans); font-size: 14px; font-weight: 600; letter-spacing: -0.04em; color: var(--fg-0); }
.footer-logo-dot { color: var(--accent-sage); }
.footer-copy { color: var(--fg-4); font-size: 11px; text-align: right; }
@media (max-width: 768px) { .site-footer { padding: var(--space-4) 20px; } }
