/* Design tokens */
:root {
  --green-900: #0A3323;
  --green-800: #2B3934;
  --grey-600: #55615D;
  --teal-700: #105666;
  --cream-100: #F7F4D5;
  --paper-50: #FDFDF7;
  --rose-400: #D3968C;
  --olive-500: #839958;
  --white: #FFFFFF;
  --border: rgba(43,57,52,0.14);
  --sel: #105666;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: 'Geist', system-ui, sans-serif;
  color: #0A3323;
  background-color: #FDFDF7;
  background-image: radial-gradient(rgba(85,97,93,0.28) 1px, transparent 1.4px);
  background-size: 24px 24px;
}

section[id] { scroll-margin-top: 72px; }
a { color: #0A3323; }
a:hover { color: #105666; }

/* ---- Frame selection ---- */
.frame {
  transition: outline-color 120ms ease;
  cursor: default;
  outline: 1px solid transparent;
  outline-offset: 3px;
  position: relative;
}
.frame[data-sel="true"] { outline: 1.5px solid #105666; }
.frame[data-hov="true"]:not([data-sel="true"]) { outline: 1px solid #105666; }

/* Frame label */
.frame-label {
  color: #55615D;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 500;
}
.frame-label[data-sel="true"],
.frame-label[data-hov="true"] { color: #105666; }

/* Corner handles */
.frame-handle {
  display: none;
  position: absolute;
  width: 9px;
  height: 9px;
  background: #fff;
  border: 1.5px solid #105666;
  pointer-events: none;
  z-index: 10;
}
.frame[data-sel="true"] .frame-handle { display: block; }

/* Size tooltip */
.frame-size {
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: #105666;
  color: #fff;
  white-space: nowrap;
  z-index: 11;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms;
}
.frame[data-sel="true"] .frame-size { opacity: 1; }

/* ---- Sidebar ---- */
.page-link:hover { background: #F7F4D5; }
.layer-item {
  background: transparent;
  font-weight: 400;
  transition: background 80ms;
}
.layer-item[aria-current="true"] {
  background: #F7F4D5;
  font-weight: 600;
}
.layer-item:hover:not([aria-current="true"]) {
  background: rgba(247,244,213,0.55);
}

/* ---- Work cards ---- */
.case-card .open-label {
  opacity: 0;
  transition: opacity 120ms ease;
}
.case-card:hover .open-label,
.case-card:focus-visible .open-label { opacity: 1; }

/* ---- Chips ---- */
.chip { font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 999px; background: #F7F4D5; }
.tool-chip { font-size: 14px; font-weight: 500; padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(16,86,102,0.3); }
.tag { font-size: 13px; font-weight: 500; padding: 5px 10px; border-radius: 999px; background: #F7F4D5; }

/* ---- Mobile nav (header row 2, desktop hidden) ---- */
.header-mobile-nav {
  display: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.header-mobile-nav::-webkit-scrollbar { display: none; }

.mobile-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 500;
  color: #55615D;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  flex-shrink: 0;
}
.mobile-nav-link.mobile-nav-active {
  color: #0A3323;
  font-weight: 600;
  border-bottom-color: #0A3323;
}
.mobile-nav-link:hover { color: #105666; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  /* Header */
  .header-resume { display: none !important; }
  .header-mobile-nav { display: flex !important; }

  /* Sidebar */
  .sidebar { display: none !important; }

  /* Main content */
  main { padding: 32px 16px 60px !important; }

  /* Typography */
  .hello-h1 { font-size: 48px !important; line-height: 1 !important; }
  .h1-page { font-size: 36px !important; line-height: 1.05 !important; }

  /* Hello and contact frames */
  .hello-frame { padding: 32px 24px !important; }
  .contact-frame { padding: 32px 24px !important; }
  .contact-frame h2 { font-size: 36px !important; }

  /* About hero: stack photo above text */
  .hero { flex-direction: column !important; align-items: flex-start !important; padding: 24px !important; gap: 20px !important; }
  .hero img { width: 100% !important; height: auto !important; }

  /* Work page featured case card */
  .case-card-featured { grid-template-columns: 1fr !important; }
  .case-card-img { grid-column: auto !important; }
  .case-card-text { grid-column: auto !important; padding-right: 0 !important; }

  /* Facts grid */
  .facts { grid-template-columns: minmax(0,1fr) !important; gap: 24px !important; }

  /* Work cards inner grid */
  .work-cards { grid-template-columns: minmax(0,1fr) !important; }

  /* Grids */
  .g2, .g3, .g4, .g5, .split, .split-grid, .resume-grid { grid-template-columns: minmax(0,1fr) !important; }
  .span2 { grid-column: auto !important; }
  .hero-row { flex-direction: column !important; align-items: flex-start !important; }
}

/* ---- Print ---- */
@media print {
  body { background: white; background-image: none; }
  nav, header { display: none !important; }
  main { padding: 0 !important; }
  @page { size: A4; margin: 0; }
}
