/* ==========================================================================
   Design tokens — monochrome editorial (muchin.framer.website reference)
   ========================================================================== */
:root {
  /* Color */
  --color-bg: #e4e3e1;
  --color-surface: #eeedeb;
  --color-text-primary: #2a2a28;
  --color-text-secondary: #5e5c5a;
  --color-text-faint: #666360;
  --color-accent: #1f1e1c;
  --color-accent-soft: rgba(31, 30, 28, 0.08);
  --color-accent-secondary: #615e59;
  --color-accent-secondary-soft: rgba(97, 94, 89, 0.1);
  --color-border: #d3d1cd;
  --color-muted: #e8e7e4;
  --color-accent-contrast: #f7f6f4;

  /* back-compat aliases used across components */
  --bg: var(--color-bg);
  --bg-elevated: var(--color-muted);
  --bg-card: var(--color-surface);
  --border: var(--color-border);
  --text: var(--color-text-primary);
  --text-muted: var(--color-text-secondary);
  --text-faint: var(--color-text-faint);
  --accent: var(--color-accent);
  --accent-soft: var(--color-accent-soft);
  --accent-contrast: var(--color-accent-contrast);

  /* Typography */
  --font-base: "Hiragino Sans", "Hiragino Kaku Gothic ProN", -apple-system,
    BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei",
    sans-serif;
  --font-display: Georgia, "Times New Roman", "Hiragino Sans", "PingFang TC",
    "Noto Sans TC", sans-serif;

  --text-display: clamp(44px, 7.2vw, 100px);
  --text-h1: clamp(40px, 5.6vw, 56px);
  --text-h2: clamp(24px, 3.4vw, 38px);
  --text-h3: clamp(18px, 2vw, 22px);
  --text-body: 16px;
  --text-small: 14px;
  --text-caption: 12.5px;

  /* Spacing (8px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  --space-section: clamp(72px, 11vw, 128px);
  --space-section-tight: clamp(44px, 6vw, 72px);

  /* Radius / shadow / motion */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(31, 30, 28, 0.05);
  --shadow-md: 0 10px 28px rgba(31, 30, 28, 0.08);
  --shadow-card: var(--shadow-sm);

  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 200ms;
  --duration-base: 350ms;
  --duration-slow: 600ms;

  --container: 1160px;
  --nav-bg: rgba(228, 227, 225, 0.86);
  --nav-bg-scrolled: rgba(228, 227, 225, 0.96);
}

:root[data-theme="dark"] {
  --color-bg: #202020;
  --color-surface: #2a2a2a;
  --color-text-primary: #f2f1ef;
  --color-text-secondary: #b8b6b2;
  --color-text-faint: #9a978f;
  --color-accent: #f7f6f4;
  --color-accent-soft: rgba(247, 246, 244, 0.1);
  --color-accent-secondary: #a5a29c;
  --color-accent-secondary-soft: rgba(165, 162, 156, 0.12);
  --color-border: #3d3d3b;
  --color-muted: #262626;
  --color-accent-contrast: #1a1a1a;

  --bg: var(--color-bg);
  --bg-elevated: var(--color-muted);
  --bg-card: var(--color-surface);
  --border: var(--color-border);
  --text: var(--color-text-primary);
  --text-muted: var(--color-text-secondary);
  --text-faint: var(--color-text-faint);
  --accent: var(--color-accent);
  --accent-soft: var(--color-accent-soft);
  --accent-contrast: var(--color-accent-contrast);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-card: var(--shadow-sm);

  --nav-bg: rgba(32, 32, 32, 0.86);
  --nav-bg-scrolled: rgba(32, 32, 32, 0.96);
}

/* ==========================================================================
   Base
   ========================================================================== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-base);
  font-size: var(--text-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--duration-base) var(--ease-standard),
    color var(--duration-base) var(--ease-standard);
}

body.nav-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  transform: translateY(-140%);
  padding: 12px 18px;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: transform var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
  transform: translateY(0);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 16px;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 1px;
  margin-right: 10px;
  background: var(--color-accent-secondary);
  flex-shrink: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-base);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--color-text-primary);
}

h1 {
  font-family: var(--font-display);
  font-size: var(--text-h1);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: 500;
  line-height: 1.18;
}

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

p {
  margin: 0 0 16px;
  color: var(--color-text-secondary);
  max-width: 62ch;
}

section {
  padding: var(--space-section) 0;
}

main > section:nth-of-type(even) {
  background: var(--color-surface);
}

section.section-tight,
section.case-section {
  padding: var(--space-section-tight) 0;
}

#work {
  padding-top: var(--space-section);
  padding-bottom: var(--space-section-tight);
}

.section-head {
  max-width: 640px;
  margin-bottom: 48px;
}

.section-head p {
  margin-bottom: 0;
}

.section-rule {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: var(--space-8);
}

.section-rule .line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ==========================================================================
   Motion / scroll reveal
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

.reveal.is-visible,
.reveal.no-js {
  opacity: 1;
  transform: none;
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}

.reveal-stagger.is-visible > *,
.reveal-stagger.no-js > * {
  opacity: 1;
  transform: none;
}

.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 90ms; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 180ms; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 270ms; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 360ms; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 450ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Nav
   ========================================================================== */
.site-nav {
  position: sticky;
  top: 14px;
  z-index: 100;
  pointer-events: none;
}

.nav-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  padding: 0 20px 0 26px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-sm);
  transition: height var(--duration-base) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard),
    background-color var(--duration-base) var(--ease-standard);
}

.site-nav.is-scrolled .nav-inner {
  height: 58px;
  background: var(--nav-bg-scrolled);
  box-shadow: var(--shadow-md);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--color-text-primary);
}

.nav-logo svg {
  display: block;
}

.nav-logo-dot {
  fill: var(--color-accent-secondary);
}

.nav-logo-badge rect {
  fill: var(--color-accent);
}

.nav-logo-badge text {
  fill: var(--color-accent-contrast);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links > li {
  position: relative;
}

.nav-links a,
.nav-links button.nav-link-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.nav-links a:hover,
.nav-links button.nav-link-btn:hover,
.nav-links a.active {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-accent-secondary);
}

.nav-caret {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform var(--duration-fast) var(--ease-standard);
}

.has-dropdown.open .nav-caret {
  transform: rotate(225deg);
  margin-top: 3px;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 250px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out), visibility var(--duration-fast);
}

.has-dropdown.open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border-bottom: none;
}

.nav-dropdown a:hover {
  background: var(--color-muted);
  color: var(--color-text-primary);
}

.nav-dropdown .dd-desc {
  display: block;
  font-size: 12px;
  color: var(--color-text-faint);
  margin-top: 2px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 1.5px;
  background: var(--color-text-primary);
  transition: transform var(--duration-fast) var(--ease-standard),
    opacity var(--duration-fast) var(--ease-standard);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.lang-toggle,
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: color var(--duration-fast), border-color var(--duration-fast),
    background-color var(--duration-fast);
}

.lang-toggle:hover,
.theme-toggle:hover {
  color: var(--color-text-primary);
  background: var(--color-muted);
  border-color: var(--color-text-faint);
}

.lang-toggle {
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  min-width: 44px;
  min-height: 44px;
}

.theme-toggle {
  padding: 8px;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-icon {
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-text-primary);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

.btn-primary:hover {
  background: var(--color-text-primary);
  border-color: var(--color-text-primary);
}

.btn-ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

.btn-ghost:hover {
  border-color: var(--color-text-primary);
  background: var(--color-muted);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn-note {
  margin-top: 12px;
  max-width: 520px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--color-text-faint);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.link-arrow .arrow {
  display: inline-block;
  transition: transform var(--duration-fast) var(--ease-out);
}

.link-arrow:hover .arrow {
  transform: translateX(4px);
}

.link-arrow::after {
  content: "";
  display: block;
  width: 0;
  height: 1px;
  background: var(--color-accent-secondary);
  transition: width var(--duration-base) var(--ease-out);
}

.link-arrow:hover::after {
  width: 100%;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  padding: clamp(48px, 7vw, 88px) 0 clamp(32px, 5vw, 56px);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: -15% -10% -35% -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 42% at 78% 12%, var(--color-accent-soft), transparent 70%),
    radial-gradient(34% 34% at 12% 65%, var(--color-accent-secondary-soft), transparent 70%);
  filter: blur(50px);
}

.hero-mark {
  position: absolute;
  left: 6px;
  top: 40px;
  writing-mode: vertical-rl;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  white-space: nowrap;
  pointer-events: none;
}

.hero-scroll {
  position: absolute;
  right: 6px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  writing-mode: vertical-rl;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  pointer-events: none;
}

.hero-scroll .line {
  width: 1px;
  height: 40px;
  background: var(--color-border);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-areas: "copy visual";
  gap: 32px 48px;
  align-items: start;
  padding-left: 28px;
}

.hero-copy {
  grid-area: copy;
}

.hero-title {
  max-width: 640px;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 500;
  line-height: 1.24;
  letter-spacing: -0.01em;
}

.hero-lede {
  max-width: 520px;
  font-size: 18px;
}

.hero-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-faint);
}

.hero-skills span:not(:last-child)::after {
  content: "·";
  margin-left: 10px;
  color: var(--color-border);
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  margin-bottom: 22px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.availability i {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fa768;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .availability i::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: inherit;
    opacity: 0.55;
    animation: availability-pulse 2.6s ease-out infinite;
  }
}

@keyframes availability-pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.55;
  }
  70% {
    transform: scale(2);
    opacity: 0;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.hero-visual {
  grid-area: visual;
  position: relative;
  display: block;
  align-self: center;
}

.hero-visual::before {
  content: "R";
  position: absolute;
  right: -14px;
  bottom: -30px;
  z-index: 0;
  font-family: var(--font-display);
  font-size: 220px;
  font-weight: 500;
  line-height: 1;
  color: var(--color-accent-secondary-soft);
  pointer-events: none;
}

/* ==========================================================================
   Hero featured-case preview (right side)
   ========================================================================== */
.hero-featured-case {
  display: block;
}

.hero-featured-link {
  display: block;
  position: relative;
  color: inherit;
  text-decoration: none;
}

.hero-featured-link::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  right: -12px;
  bottom: -12px;
  background: var(--color-accent-soft);
  border-radius: 8px;
  z-index: 0;
}

.hero-featured-media {
  position: relative;
  z-index: 1;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.hero-featured-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: grayscale(0.5) contrast(1.05);
  transition: transform var(--duration-slow) var(--ease-out);
}

.hero-featured-link:hover .hero-featured-media img {
  transform: scale(1.02);
}

.hero-featured-caption {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 18px;
}

.hero-featured-caption strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.hero-featured-caption span {
  font-size: 13px;
  color: var(--color-text-faint);
}

/* ==========================================================================
   Resume panel
   ========================================================================== */
.resume-panel {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  padding: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.resume-panel-mark {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.resume-panel-body h2 {
  margin: 2px 0 8px;
}

.resume-panel-body > p {
  color: var(--color-text-secondary);
  max-width: 60ch;
  margin: 0 0 18px;
}

.resume-panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
}

.resume-panel-tags li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--color-text-secondary);
}

.resume-panel-tags svg {
  flex-shrink: 0;
  color: var(--color-accent-secondary);
}

@media (max-width: 640px) {
  .resume-panel {
    flex-direction: column;
    gap: 18px;
    padding: 24px;
  }
}

/* ==========================================================================
   About, Strengths & AI Workflow (merged homepage section)
   ========================================================================== */
.about-body {
  max-width: 640px;
  margin-bottom: 48px;
}

.about-body .case-quote {
  margin: 24px 0 0;
}

.about-body .link-arrow {
  margin-top: 24px;
}

/* ==========================================================================
   Editorial project grid
   ========================================================================== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
  transition: transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.project-card .project-media {
  margin-bottom: var(--space-5);
}

.project-card:first-child {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: stretch;
  gap: 32px;
}

.project-card:first-child .project-media {
  flex: 1.2;
  aspect-ratio: 3 / 2;
  margin-bottom: 0;
}

.project-card:first-child .project-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.project-grid-note {
  grid-column: 1 / -1;
  margin: 8px 0 -8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.project-card--compact .project-media {
  aspect-ratio: 16 / 10;
}

.project-card--compact {
  padding: var(--space-5);
}

.project-index {
  display: block;
  margin-bottom: var(--space-4);
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--color-text-faint);
}

.project-card:hover .project-index {
  color: var(--color-accent-secondary);
}

.project-info h3 {
  margin-bottom: 6px;
  font-size: clamp(22px, 2vw, 26px);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-accent);
  margin-bottom: 16px;
}

.project-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 10px;
  color: var(--color-border);
}

.project-info p {
  font-size: 15px;
}

.project-info p.problem {
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.project-contribution {
  font-size: 13.5px !important;
  color: var(--color-text-faint);
  margin: 14px 0 0 !important;
}

.project-contribution b {
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-right: 6px;
}

.project-contribution span {
  color: var(--color-text-secondary);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}

.tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--color-muted);
  color: var(--color-text-secondary);
}

.tag.muted {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-faint);
}

.project-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.project-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.project-badge svg {
  flex-shrink: 0;
}

.case-hero-image .project-badge {
  top: 14px;
  left: 14px;
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-md);
  transition: transform var(--duration-slow) var(--ease-out);
}

.project-card:hover .project-media img {
  transform: scale(1.025);
}

/* ==========================================================================
   Case study
   ========================================================================== */
.case-hero {
  padding: clamp(40px, 6vw, 64px) 0 40px;
  border-bottom: 1px solid var(--color-border);
}

.case-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.5;
  color: var(--color-text-primary);
  margin: 28px 0 0;
  padding-left: 22px;
  border-left: 2px solid var(--color-accent-secondary);
  max-width: 620px;
}

.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.case-meta + .tag-row {
  margin-top: 20px;
}

.case-meta dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: 6px;
}

.case-meta dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.case-hero-image {
  position: relative;
  margin-top: 40px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
}

.case-snapshot {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.case-snapshot-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

.case-snapshot-row:first-child {
  padding-top: 0;
}

.case-snapshot-row:last-child {
  border-bottom: none;
}

.case-snapshot-row dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}

.case-snapshot-row dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .case-snapshot-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.case-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(28px, 5vw, 56px);
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.case-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.case-stat-num {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 600;
  line-height: 1;
}

.case-stat-label {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
}

.case-section h2 {
  max-width: 640px;
}

.case-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.case-icon {
  flex-shrink: 0;
  color: var(--color-accent-secondary);
}

.case-section .lede {
  font-size: 17px;
  max-width: 700px;
}

.shot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.shot-gallery figure {
  margin: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.shot-gallery .frame {
  aspect-ratio: 4 / 3;
  background: var(--color-muted);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shot-gallery .frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform var(--duration-slow) var(--ease-out);
}

.shot-gallery figure:hover .frame img {
  transform: scale(1.03);
}

/* content-aware frame ratios so screenshots aren't force-cropped into a
   mismatched box — phones stay tall, dashboards/browsers stay wide,
   diagrams stay closer to square */
.shot-gallery .frame--tall {
  aspect-ratio: 3 / 4;
}

.shot-gallery .frame--wide {
  aspect-ratio: 16 / 10;
}

.shot-gallery .frame--square {
  aspect-ratio: 5 / 4;
}

.shot-gallery.wide .frame {
  aspect-ratio: 16 / 9;
}

.shot-gallery figcaption {
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--color-text-faint);
}

.shot-gallery.wide {
  grid-template-columns: 1fr;
}

.shot-gallery.narrow {
  grid-template-columns: minmax(0, 320px);
}

.process-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.process-strip .step {
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.process-strip .step .num {
  font-family: var(--font-display);
  font-size: 13px;
  font-style: italic;
  color: var(--color-accent-secondary);
  margin-bottom: 10px;
  display: block;
}

/* ==========================================================================
   Insight → Decision → Screen map (case study)
   ========================================================================== */
.insight-map {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}

.insight-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.insight-part {
  font-size: 14.5px;
}

.insight-part.insight {
  font-weight: 600;
  color: var(--color-text-primary);
}

.insight-part.decision {
  color: var(--color-text-secondary);
}

.insight-part.screen {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--color-accent-secondary);
}

.insight-arrow {
  color: var(--color-text-faint);
  flex-shrink: 0;
}

/* ==========================================================================
   Iteration (wireframe → final UI)
   ========================================================================== */
.iteration-media {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
}

.iteration-media figure {
  flex: 1;
  min-width: 200px;
  margin: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.iteration-media .frame {
  aspect-ratio: 4 / 3;
  background: var(--color-muted);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iteration-media .frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.iteration-media figcaption {
  padding: 12px 16px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.iteration-arrow {
  flex-shrink: 0;
  font-size: 20px;
  color: var(--color-text-faint);
}

@media (max-width: 640px) {
  .iteration-media {
    flex-direction: column;
  }

  .iteration-arrow {
    transform: rotate(90deg);
  }
}

.case-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 40px 0;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.case-nav a {
  padding: 18px 22px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 200px;
  transition: border-color var(--duration-fast), background-color var(--duration-fast);
}

.case-nav a:hover {
  border-color: var(--color-text-primary);
  background: var(--color-muted);
}

.case-nav .dir {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  margin-bottom: 4px;
}

.case-nav .next {
  text-align: right;
}

/* ==========================================================================
   About page
   ========================================================================== */
.about-hero {
  padding-bottom: clamp(40px, 6vw, 64px);
}

.about-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 280px) 1fr;
  gap: 48px;
  align-items: center;
}

.about-hero-photo {
  width: min(100%, 280px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-muted);
}

.about-hero-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 35%;
  filter: grayscale(0.5) contrast(1.05);
}

.about-hero-copy {
  max-width: 680px;
}

.about-hero-kicker {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.about-hero-meta {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--color-text-faint);
}

.about-story {
  padding-top: 0;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 8px;
}

.work-item h3 {
  margin-bottom: 8px;
}

.work-item p {
  margin-bottom: 0;
  font-size: 14.5px;
}

.work-note {
  margin: 28px 0 0;
  max-width: 640px;
  font-size: 13px;
  color: var(--color-text-faint);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 8px;
}

.skills-grid h3 {
  margin-bottom: 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
}

.skills-grid p {
  margin-bottom: 0;
  font-size: 14.5px;
}

.about-cta-info {
  max-width: 480px;
  margin-top: 8px;
}

#experience,
#contact {
  scroll-margin-top: 100px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 56px;
}

.about-preview-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 56px;
  align-items: start;
}

.about-preview-grid h2 {
  max-width: 360px;
}

.about-preview-grid .lede {
  max-width: 56ch;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 28px 28px;
  border-left: 1px solid var(--color-border);
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent-secondary);
}

.timeline .role {
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--color-text-primary);
}

.timeline .period {
  font-size: 13px;
  color: var(--color-text-faint);
  margin-bottom: 6px;
  display: block;
}

.skill-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.skill-table tr {
  border-bottom: 1px solid var(--color-border);
}

.skill-table tr:first-child {
  border-top: 1px solid var(--color-border);
}

.skill-table th,
.skill-table td {
  text-align: left;
  padding: 14px 0;
  vertical-align: top;
  font-size: 14.5px;
}

.skill-table th {
  width: 34%;
  font-weight: 600;
  color: var(--color-text-faint);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-right: 16px;
}

.skill-table td {
  color: var(--color-text-secondary);
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.info-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14.5px;
}

.info-list li span:first-child {
  color: var(--color-text-faint);
}

/* ==========================================================================
   Graphic design gallery
   ========================================================================== */
.gd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.gd-grid .placeholder {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
  font-size: 13.5px;
  text-align: center;
  padding: 20px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 48px 0;
  background-image: radial-gradient(var(--color-border) 1px, transparent 1px);
  background-size: 22px 22px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 32px;
  align-items: center;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.footer-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.footer-contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--color-text-secondary);
}

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

.footer-mark {
  position: relative;
  width: 52px;
  height: 52px;
  justify-self: center;
}

.footer-mark-ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
}

.footer-mark-ring::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
}

.footer-mark-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  background: var(--color-accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.footer-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
}

.footer-info p {
  margin: 0;
  max-width: 34ch;
  font-size: 13.5px;
  color: var(--color-text-faint);
}

@media (min-width: 900px) {
  .footer-info p {
    white-space: nowrap;
    max-width: none;
  }
}

.footer-meta {
  color: var(--color-text-faint);
  font-size: 13.5px;
}

.footer-top {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.footer-top:hover {
  color: var(--color-accent);
}

@media (max-width: 700px) {
  .footer-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 28px;
  }

  .footer-contact,
  .footer-info {
    align-items: center;
    text-align: center;
  }

  .footer-info p {
    max-width: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-mark,
  .hero-scroll {
    display: none;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 901px) {
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "visual";
    padding-left: 24px;
  }

  .hero-visual {
    margin-top: 8px;
    align-self: start;
  }

  .hero-visual::before {
    font-size: 140px;
    bottom: -20px;
  }
}

@media (max-width: 900px) {
  .project-card:first-child {
    grid-column: auto;
    flex-direction: column;
    gap: 0;
  }

  .project-card:first-child .project-media {
    flex: none;
    aspect-ratio: 4 / 3;
    margin-bottom: var(--space-5);
  }

  .project-card:first-child .project-info {
    display: block;
  }
}

@media (max-width: 880px) {
  .about-hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .about-hero-photo {
    width: min(100%, 240px);
    margin: 0 auto;
  }

  .about-grid,
  .about-preview-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .about-preview-grid h2 {
    max-width: none;
  }

  .work-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 480px) {
  .about-hero-photo {
    width: min(100%, 200px);
  }
}

@media (max-width: 760px) {
  .hero-visual::before {
    display: none;
  }

  .nav-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
  }

  .nav-links {
    position: fixed;
    top: 92px;
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    gap: 2px;
    box-shadow: var(--shadow-md);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-fast) var(--ease-standard);
    max-height: calc(100vh - 108px);
    overflow-y: auto;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links a,
  .nav-links button.nav-link-btn {
    width: 100%;
    min-height: 46px;
    justify-content: space-between;
  }

  .nav-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
    box-shadow: none;
    margin-top: 4px;
  }

  .has-dropdown.open .nav-dropdown {
    display: block;
  }

  .project-meta {
    font-size: 11.5px;
  }

  .case-nav .next {
    text-align: left;
  }

  .btn-row .btn {
    flex: 1;
    justify-content: center;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .case-links,
  .resume-panel-body .btn-row {
    flex-direction: column;
    align-items: stretch;
  }

  .case-links .btn,
  .resume-panel-body .btn-row .btn {
    flex: 1 1 auto;
    width: 100%;
    min-height: 52px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }
}

/* ==========================================================================
   High-contrast preference
   ========================================================================== */
@media (prefers-contrast: more) {
  :root {
    --color-border: #a8a6a1;
    --color-text-secondary: #3a3937;
    --color-text-faint: #46443f;
  }

  :root[data-theme="dark"] {
    --color-border: #6e6c68;
    --color-text-secondary: #dedcd8;
    --color-text-faint: #c9c7c1;
  }
}
