/* ── Design Tokens ─────────────────────────────────── */
:root,
[data-theme="light"] {
  --color-bg: #f7f6f2;
  --color-surface: #f0ede8;
  --color-border: #d4d1ca;
  --color-text: #28251d;
  --color-text-muted: #7a7974;
  --color-text-faint: #bab9b4;
  --color-primary: #01696f;
  --color-primary-hover: #0c4e54;
  --color-orange: #d35400;
  --color-orange-hover: #e67e22;
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 6px 20px oklch(0.2 0.01 80 / 0.09);
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Switzer', 'Helvetica Neue', sans-serif;
  --radius-full: 9999px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --color-bg: #171614;
  --color-surface: #1c1b19;
  --color-border: #393836;
  --color-text: #cdccca;
  --color-text-muted: #797876;
  --color-text-faint: #5a5957;
  --color-primary: #4f98a3;
  --color-primary-hover: #227f8b;
  --color-orange: #e67e22;
  --color-orange-hover: #f39c12;
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 6px 20px oklch(0 0 0 / 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #171614;
    --color-surface: #1c1b19;
    --color-border: #393836;
    --color-text: #cdccca;
    --color-text-muted: #797876;
    --color-text-faint: #5a5957;
    --color-primary: #4f98a3;
    --color-primary-hover: #227f8b;
    --color-orange: #e67e22;
    --color-orange-hover: #f39c12;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 6px 20px oklch(0 0 0 / 0.35);
  }
}

/* ── Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition), color var(--transition);
  display: flex;
  flex-direction: column;
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
}

::selection {
  background: oklch(from var(--color-primary) l c h / 0.2);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1.5rem;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  z-index: 2000;
  border-radius: 0 0 12px 12px;
  text-decoration: none;
  font-weight: 500;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Header nav ─────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.75rem;
}

/* ── Hamburger Menu ────────────────────────────────── */
.menu-toggle {
  width: 2.1rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: transparent;
  transition: color var(--transition), background var(--transition);
  z-index: 1100;
}

.menu-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--color-bg);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8rem;
  gap: 2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

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

.nav-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a,
.nav-links button {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition), transform var(--transition);
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--color-text);
  transform: scale(1.05);
}

.nav-links a.orange-link {
  color: var(--color-text-muted);
}

.nav-links a.orange-link:hover {
  color: var(--color-text);
}

.nav-links a.nav-orange {
  color: var(--color-orange);
}

.nav-links a.nav-orange:hover {
  color: var(--color-orange-hover);
}

.nav-links button.nav-orange {
  color: var(--color-orange);
}

.nav-links button.nav-orange:hover {
  color: var(--color-orange-hover);
}

/* ── Dropdown in Menu ──────────────────────────────── */
.menu-dropdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
}

.menu-dropdown:has(.menu-dropdown-content.show) {
  gap: 0.75rem;
}

.menu-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.menu-dropdown-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 1rem;
  margin-top: 0;
  border: 0 solid var(--color-border);
  border-radius: 12px;
  width: 100%;
  max-width: 260px;
  background: var(--color-surface);
  transition: max-height 0.2s ease, opacity 0.2s ease, padding 0.2s ease, margin-top 0.2s ease, border-width 0.2s ease;
}

.menu-dropdown-content.show {
  max-height: 500px;
  opacity: 1;
  padding: 1rem;
  margin-top: 0.5rem;
  border-width: 1px;
}

.menu-dropdown-content a {
  font-size: 1rem;
}

.menu-dropdown-content a.orange-link {
  color: var(--color-orange);
}

.menu-dropdown-content a.orange-link:hover {
  color: var(--color-orange-hover);
}

/* ── Theme Toggle ──────────────────────────────────── */
.theme-toggle {
  width: 2.1rem;
  height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: color var(--transition), background var(--transition);
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

/* ── Layout ────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(3rem, 10vw, 6rem) 1.5rem;
}

.card {
  width: 100%;
  max-width: 580px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.letter-container {
  width: 100%;
  max-width: 680px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.letter-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text);
  margin-bottom: 1rem;
}

.letter-content p {
  margin-bottom: 1.5rem;
  color: var(--color-text-muted);
  line-height: 1.8;
}

/* ── Downloads Grid ────────────────────────────────── */
.downloads-container {
  width: 100%;
  max-width: 800px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 3rem;
  margin-top: 2rem;
}

.download-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  background: transparent;
  border: none;
  text-decoration: none;
  transition: transform var(--transition);
}

.download-card-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: filter 0.3s ease;
  position: relative;
}

.download-overlay {
  position: absolute;
  inset: -10px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  background: transparent;
  backdrop-filter: blur(2px);
  color: var(--color-orange);
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 50;
}

.download-card:hover .download-card-content {
  filter: blur(3px);
}

.download-card:hover .download-overlay {
  opacity: 1;
}

.download-card:hover {
  transform: translateY(-5px);
}

/* ── Book Covers ───────────────────────────────────── */
.book-cover {
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  position: relative;
  background: #fff;
  padding: 2px;
  /* Slimmer paper edge */
  z-index: 10;
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.15);
  border: 1px solid oklch(0 0 0 / 0.1);
}

/* Underlying paper sheets */
.book-cover::before,
.book-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  border: 1px solid oklch(0 0 0 / 0.1);
  pointer-events: none;
}

.book-cover::before {
  z-index: -1;
  transform: translate(4px, 3px) rotate(1deg);
}

.book-cover::after {
  z-index: -2;
  transform: translate(8px, 6px) rotate(2deg);
  box-shadow: 1px 2px 4px oklch(0 0 0 / 0.1);
}

.book-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 11;
  border: 1px solid oklch(0 0 0 / 0.05);
}

/* Spine/Binding Shadow on the main image */
.download-card-content::after {
  content: '';
  position: absolute;
  left: calc(12px + 2px);
  top: calc(12px + 2px);
  bottom: calc(12px + 2px);
  width: 4px;
  background: linear-gradient(to right, oklch(0 0 0 / 0.12), transparent);
  z-index: 20;
  pointer-events: none;
}

.signature {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-text);
  margin-top: 2rem !important;
}

.download-now-container {
  margin-top: 3rem;
  display: flex;
  justify-content: flex-start;
}

.download-now-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-orange);
  text-decoration: none;
  padding: 0.8em 2em;
  border: 1px solid var(--color-orange);
  border-radius: var(--radius-full);
  background: transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
}

.download-now-btn:hover {
  color: #fff;
  border-color: var(--color-orange-hover);
  background: var(--color-orange-hover);
  transform: translateY(-2px);
}

/* ── Avatar ────────────────────────────────────────── */
.avatar-wrap {
  position: relative;
  width: clamp(100px, 22vw, 148px);
  height: clamp(100px, 22vw, 148px);
  flex-shrink: 0;
}

.avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  transition: border-color var(--transition);
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  object-position: center top;
  box-shadow: var(--shadow-md);
}

/* ── Name ──────────────────────────────────────────── */
.name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.name em {
  font-style: italic;
  color: var(--color-orange);
}

/* ── Tags ──────────────────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.tag {
  font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 0.3em 0.85em;
  border-radius: var(--radius-full);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

/* ── Divider ───────────────────────────────────────── */
.divider {
  width: 2.5rem;
  height: 1px;
  background: var(--color-border);
  transition: background var(--transition);
}

/* ── Utilities ─────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Bio ───────────────────────────────────────────── */
.bio {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
  line-height: 1.75;
  color: var(--color-text-muted);
  max-width: 52ch;
  text-align: justify;
}

.bio strong {
  color: var(--color-text);
  font-weight: 500;
}

/* ── Footer ────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  color: var(--color-text-faint);
  letter-spacing: 0.02em;
}

/* ── Manifesto (About page) ───────────────────────── */
.section-label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 2.5rem 0 1rem 0;
}

.lead-quote {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.05rem + 1vw, 1.7rem);
  line-height: 1.35;
  font-style: italic;
  color: var(--color-orange);
  border-left: 3px solid var(--color-orange);
  padding-left: 1rem;
  margin: 0 0 1.5rem 0;
}

.ikigai-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 1.5rem 0 2rem 0;
}

.ikigai-box {
  border-top: 1px solid var(--color-border);
  padding-top: 0.6rem;
}

.ikigai-box .k {
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-orange);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.ikigai-box .v {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

@media (max-width: 480px) {
  .ikigai-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Fade-in animation ─────────────────────────────── */
.card,
.letter-container {
  animation: fadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}