/*
 * Unified visual and interaction layer
 * One restrained editorial system across every previously independent scene.
 */
:root {
  --ui-canvas: #f5f4ef;
  --ui-paper: rgba(250, 249, 245, .9);
  --ui-ink: #293451;
  --ui-muted: #67718a;
  --ui-accent: #6676aa;
  --ui-accent-soft: #dce3f2;
  --ui-rule: rgba(48, 61, 91, .16);
  --ui-rule-strong: rgba(48, 61, 91, .3);
  --ui-dark: #111a2f;
  --ui-radius-sm: 8px;
  --ui-radius-md: 16px;
  --ui-shadow: 0 20px 70px rgba(42, 54, 86, .1);
  --ui-motion: cubic-bezier(.22, 1, .36, 1);
}

html {
  scroll-padding-top: 76px;
}

body {
  background: var(--ui-canvas);
  color: var(--ui-ink);
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled),
a[href] {
  cursor: pointer;
}

:where(a, button):focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 4px;
}

::selection {
  color: #fff;
  background: var(--ui-accent);
}

/* Shared navigation shell */
.nav {
  min-height: 72px;
  padding: 18px clamp(24px, 5vw, 72px);
  color: var(--ui-ink);
  background: rgba(247, 246, 242, .78);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.nav.is-scrolled {
  padding-top: 12px;
  padding-bottom: 12px;
  color: var(--ui-ink);
  background: rgba(247, 246, 242, .92);
  border-color: var(--ui-rule);
  box-shadow: 0 8px 30px rgba(39, 52, 82, .05);
}

.nav .logo {
  font-weight: 500;
  letter-spacing: .1em;
}

.nav .logo span {
  border-color: var(--ui-rule-strong);
}

.nav nav {
  gap: clamp(20px, 2.8vw, 40px);
}

.nav nav a {
  opacity: .54;
}

.nav nav a:hover,
.nav nav a.active {
  opacity: 1;
}

.nav nav a::after {
  bottom: -10px;
  background: var(--ui-accent);
}

.nav .say-hi {
  min-height: 36px;
  padding: 0 2px;
  border-color: var(--ui-rule-strong);
}

/* Consistent section rhythm and type hierarchy */
.resume-editorial-section,
.work,
.lake-section,
.future-lab,
.life-universe {
  border-top: 1px solid var(--ui-rule);
}

.resume-editorial-section,
.work,
.lake-section,
.future-lab,
.life-universe {
  scroll-margin-top: 70px;
}

.section-label,
.section-label.light {
  color: var(--ui-muted);
  font-weight: 500;
  letter-spacing: .13em;
}

.section-label span {
  color: var(--ui-accent);
}

.work > header h2,
.lake-heading h2,
.future-heading h2,
.life-universe > header h2 {
  color: var(--ui-ink);
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -.055em;
}

.work > header,
.lake-heading,
.future-heading,
.life-universe > header {
  margin-bottom: clamp(42px, 6vw, 78px);
}

/* Reuse one surface language where content behaves like a control */
.folder-tabs button,
.project-file,
.reflection,
.world-trigger,
.photo-wall figure button,
.resume-potential-links button,
.dialog-action,
.contact-shell a,
.contact-shell > div button {
  transition:
    color .25s ease,
    background-color .25s ease,
    border-color .25s ease,
    box-shadow .35s var(--ui-motion),
    transform .35s var(--ui-motion);
}

.folder-tabs button:hover,
.resume-potential-links button:hover {
  transform: translateY(-2px);
}

.project-file:hover,
.reflection:hover,
.world-trigger:hover,
.photo-wall figure:hover {
  box-shadow: var(--ui-shadow);
}

/* Project archive: remove the unrelated pastel-folder palette */
.project-folder {
  --folder-paper: rgba(250, 249, 245, .92);
  --folder-ink: var(--ui-ink);
  --folder-rule: var(--ui-rule);
}

.folder-tabs {
  border-bottom: 1px solid var(--ui-rule);
}

.folder-tabs button {
  color: var(--ui-muted);
  background: transparent !important;
  border-color: transparent !important;
}

.folder-tabs button.active {
  color: var(--ui-ink);
  background: rgba(255, 255, 255, .62) !important;
  border-color: var(--ui-rule) !important;
}

.folder-tabs button.active::after {
  background: var(--ui-accent);
}

.folder-page,
.folder-page[data-tone] {
  color: var(--ui-ink);
  background:
    radial-gradient(circle at 88% 4%, rgba(167, 184, 218, .2), transparent 28%),
    linear-gradient(145deg, rgba(251, 250, 247, .98), rgba(235, 239, 246, .96));
  border-color: var(--ui-rule);
  box-shadow: var(--ui-shadow);
}

.folder-page-header,
.project-file,
.folder-detail {
  border-color: var(--ui-rule);
}

.project-file:hover,
.project-file.active {
  background: rgba(255, 255, 255, .72);
}

.project-file-cover {
  border-radius: var(--ui-radius-sm);
  overflow: hidden;
}

/* Thinking lake is still a scene, but labels now belong to the same UI */
.lake-section {
  background: linear-gradient(180deg, #eef1f5 0%, #e6ebf2 100%);
}

.reflection {
  border-color: rgba(255, 255, 255, .34);
  border-radius: var(--ui-radius-sm);
}

.reflection:hover,
.reflection:focus-visible {
  border-color: rgba(255, 255, 255, .64);
  background: rgba(255, 255, 255, .09);
}

.truth-mirror {
  border-radius: var(--ui-radius-md);
  box-shadow: 0 36px 110px rgba(11, 20, 39, .3);
}

/* Future area: align its saturated illustration scene with the ink palette */
.future-lab {
  background:
    radial-gradient(circle at 78% 8%, rgba(188, 200, 228, .35), transparent 24%),
    linear-gradient(180deg, #f3f1ed 0%, #e8edf3 100%);
}

.future-heading > p,
.future-heading > span,
.future-stage-note {
  color: var(--ui-muted);
}

.future-stage {
  border-color: var(--ui-rule);
  border-radius: var(--ui-radius-md);
  box-shadow: var(--ui-shadow);
}

.world-label {
  color: var(--ui-ink);
  border-color: var(--ui-rule-strong);
}

.world-label::before {
  background: var(--ui-accent);
}

/* Life stays dark, but uses the same blue-ink family and caption treatment */
.life-universe {
  background:
    radial-gradient(circle at 74% 18%, rgba(114, 132, 179, .24), transparent 28%),
    linear-gradient(155deg, #10182b, #18233a 56%, #111a2e);
}

.life-universe > header h2 {
  color: rgba(255, 255, 255, .92);
}

.life-universe .section-label,
.life-universe .section-label.light {
  color: rgba(255, 255, 255, .54);
}

.fragment-universe figure::before {
  border-color: rgba(221, 228, 244, .18);
}

.fragment-universe figcaption {
  border-radius: 999px;
  border-color: rgba(255, 255, 255, .18) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Dialogs feel like part of the same site, not a separate dark application */
.content-dialog,
.contact-dialog {
  border-color: var(--ui-rule-strong);
  border-radius: var(--ui-radius-md);
  box-shadow: 0 40px 140px rgba(16, 24, 45, .34);
}

.content-dialog {
  color: var(--ui-ink);
  background: #f5f4ef;
}

.dialog-content {
  background:
    radial-gradient(circle at 100% 0, rgba(180, 193, 222, .22), transparent 26%),
    #f5f4ef;
}

.dialog-meta,
.dialog-lead,
.dialog-section span,
.dialog-section p {
  color: var(--ui-muted);
}

.dialog-tags span,
.dialog-section {
  border-color: var(--ui-rule);
}

.dialog-action {
  color: var(--ui-ink);
  border-color: var(--ui-rule-strong);
  border-radius: 999px;
}

.dialog-action:hover {
  color: #fff;
  background: var(--ui-ink);
}

.dialog-close {
  color: var(--ui-ink);
  background: rgba(247, 246, 242, .86);
  border-color: var(--ui-rule-strong);
}

.contact-dialog {
  color: var(--ui-ink);
  background: linear-gradient(145deg, #f4f2ed, #e1e6f0);
}

.contact-shell a,
.contact-shell > div button {
  min-height: 44px;
  border-radius: 999px;
  border-color: var(--ui-rule-strong);
}

footer {
  background: var(--ui-dark);
}

@media (max-width: 760px) {
  .nav {
    min-height: 64px;
    padding: 12px 18px;
  }

  .nav .logo {
    max-width: 40px;
    overflow: hidden;
    white-space: nowrap;
  }

  .nav .logo span {
    flex: 0 0 auto;
  }

  .nav nav {
    position: absolute;
    top: 64px;
    left: 0;
    display: flex !important;
    width: 100%;
    gap: 0;
    padding: 0 14px;
    overflow-x: auto;
    background: rgba(247, 246, 242, .94);
    border-bottom: 1px solid var(--ui-rule);
    scrollbar-width: none;
  }

  .nav nav::-webkit-scrollbar {
    display: none;
  }

  .nav nav a {
    flex: 0 0 auto;
    min-height: 44px;
    display: grid;
    place-items: center;
    padding: 0 16px;
  }

  .nav nav a::after {
    bottom: 0;
  }

  .nav .say-hi {
    min-width: 62px;
  }

  .hero {
    padding-top: 132px;
  }

  .hero-code {
    position: absolute;
    top: 132px;
    left: 20px;
  }

  .hero-note {
    position: absolute;
    top: 356px;
    right: auto;
    bottom: auto;
    left: 24px;
    max-width: 250px;
    margin: 0;
  }

  html {
    scroll-padding-top: 112px;
  }

  .resume-editorial-section,
  .work,
  .lake-section,
  .future-lab,
  .life-universe {
    scroll-margin-top: 108px;
  }

  .content-dialog,
  .contact-dialog {
    width: calc(100% - 16px);
    max-height: calc(100svh - 16px);
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
