/* ============================================================
   Theme tokens — light only.
   Values stored as space-separated RGB triplets so Tailwind
   utilities like bg-deep-midnight/40 work via <alpha-value>.
   Class names kept (deep-midnight, frost-white) for token continuity
   even though they now hold light-mode values.
   ============================================================ */

:root {
  --canvas: 250 249 246;       /* warm off-white          */
  --line:   224 222 217;       /* soft warm border        */
  --fg:     12 12 11;          /* deep midnight as text   */
  --muted:  107 111 118;       /* readable secondary      */
  --whisper: 180 180 175;
  --accent: 37 99 235;         /* electric blue accent    */
  --content-width: 60rem;      /* 960px — primary content */
  --media-width: 72rem;        /* 1152px — visual content */
  color-scheme: light;
}

/* ============================================================
   Typography — sans default (Inter), .serif variant (Newsreader)
   Mono (Space Mono) stays unchanged across both modes.
   ============================================================ */

html { scroll-behavior: smooth; }

strong { font-weight: 500; }

/* Body copy — readable hierarchy without loosening dense metadata. */
.text-body    { font-size: 15px !important; line-height: 1.55; letter-spacing: -0.005em; }
.text-body-sm { font-size: 14px !important; line-height: 1.43; letter-spacing: 0; }
.text-subheading { font-size: 20px !important; line-height: 1.35; font-weight: 500; }

h1, h2, h3, h4 { text-wrap: balance; }
p, li, dd, blockquote { text-wrap: pretty; }

img,
video {
  max-width: 100%;
}

img {
  height: auto;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

.font-mono {
  font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
}

html.serif body,
html.serif h1,
html.serif h2,
html.serif h3,
html.serif p {
  font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
  letter-spacing: 0;
}

/* Mono captions stay mono (override serif inheritance) */
html.serif .font-mono { font-family: 'Space Mono', ui-monospace, monospace; letter-spacing: 0.1em; }

/* Serif mode — scaled up font sizes for readability
   Newsreader x-height is smaller than Inter; ~12% bump restores
   comparable optical size. */
html.serif .text-caption     { font-size: 12px; }
html.serif .text-body-sm     { font-size: 14px; }
html.serif .text-body        { font-size: 16px; }
html.serif .text-subheading  { font-size: 20px; }
html.serif .text-heading     { font-size: 33px; }
html.serif .text-heading-lg  { font-size: 44px; }
html.serif .text-display     { font-size: 70px; }

html.serif .prose p          { font-size: 17px; }
html.serif .prose h2         { font-size: 21px; }
html.serif .meta-grid dd     { font-size: 14px; }

/* ============================================================
   Links
   ============================================================ */

.link-underline {
  text-decoration: underline;
  text-decoration-color: rgb(var(--fg) / 0.20);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .2s ease;
}
.link-underline:hover { text-decoration-color: rgb(var(--fg)); }

.link-hover-underline {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .2s ease;
}
.link-hover-underline:hover { text-decoration-color: rgb(var(--fg) / 0.45); }

/* ============================================================
   Nav (sticky blur)
   ============================================================ */

.nav-blur {
  background: rgb(var(--canvas) / 0.55);
  backdrop-filter: saturate(200%) blur(24px);
  -webkit-backdrop-filter: saturate(200%) blur(24px);
}

/* ============================================================
   List item hover
   ============================================================ */

.item-row { transition: background-color .15s ease; }
.item-row:hover { background-color: rgb(var(--fg) / 0.025); }

/* ============================================================
   Section divider — line between top-level page sections
   ============================================================ */

.section-divider {
  border: 0;
  border-top: 1px solid rgb(var(--line));
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}

/* Expand the editorial canvas on desktop while preserving the existing
   mobile/tablet rhythm and comfortable line lengths (`max-w-2xl`). */
@media (min-width: 64rem) {
  .max-w-3xl { max-width: var(--content-width) !important; }
  .max-w-5xl { max-width: var(--media-width) !important; }
}

@media (max-width: 39.999rem) {
  nav .max-w-3xl {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  nav .max-w-3xl > .flex {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px !important;
  }
}

/* ============================================================
   Work reel video
   ============================================================ */

.work-reel {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgb(var(--line));
  background: rgb(var(--canvas));
}
.work-reel video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.work-reel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 60%, rgb(var(--canvas) / 0.35) 100%);
}

/* ============================================================
   Password gate — client-side (NOT real security, deterrent only)
   ============================================================ */

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(var(--canvas));
}
html.authed .gate-overlay { display: none; }

.gate-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.gate-mark {
  height: 32px;
  width: auto;
  display: block;
  margin: 0 auto 28px;
}
.gate-caption {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(var(--muted));
  margin-bottom: 12px;
}
.gate-title {
  font-size: 16px;
  letter-spacing: -0.005em;
  color: rgb(var(--fg));
  margin-bottom: 24px;
  line-height: 1.5;
}
.gate-form {
  display: flex;
  gap: 8px;
}
.gate-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgb(var(--line));
  border-radius: 9999px;
  background: rgb(var(--canvas));
  color: rgb(var(--fg));
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.gate-input::placeholder { color: rgb(var(--muted)); }
.gate-input:focus {
  border-color: rgb(var(--accent));
  box-shadow: 0 0 0 2px rgb(var(--accent) / 0.2);
}
.gate-submit {
  padding: 0 18px;
  border-radius: 9999px;
  background: rgb(var(--fg));
  color: rgb(var(--canvas));
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  border: 0;
  cursor: pointer;
  transition: opacity .2s ease;
  white-space: nowrap;
}
.gate-submit:hover { opacity: 0.85; }
.gate-error {
  margin-top: 12px;
  font-size: 13px;
  color: #dc2626;
  min-height: 1.4em;
  opacity: 0;
  transition: opacity .2s ease;
}
.gate-error.show { opacity: 1; }
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.gate-form.shake { animation: gate-shake .3s; }

/* ============================================================
   Pills — category labels (rituais eixos)
   ============================================================ */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.4;
  font-weight: 400;
}
.pill--tasting {
  background-color: rgba(217, 119, 6, 0.14);
  color: #92400e;
}
.pill--tecnica {
  background-color: rgba(79, 70, 229, 0.14);
  color: #3730a3;
}
.pill--craft {
  background-color: rgba(22, 163, 74, 0.12);
  color: #166534;
}
.pill--lideranca {
  background-color: rgba(37, 99, 235, 0.10);
  color: #1e40af;
}

/* Status pills — Oportunidades de Melhoria */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.6;
  white-space: nowrap;
}
.status-pill--identificado {
  background-color: rgb(var(--line) / 0.5);
  color: rgb(var(--muted));
}
.status-pill--desenvolvendo {
  background-color: rgba(217, 119, 6, 0.12);
  color: #92400e;
}
.status-pill--resolvido {
  background-color: rgba(22, 163, 74, 0.12);
  color: #166534;
}

/* ============================================================
   Nav dropdown
   ============================================================ */

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgb(var(--fg) / 0.8);
  transition: color .2s ease;
  cursor: pointer;
  text-decoration: none;
}
.nav-dropdown:hover .nav-dropdown-trigger { color: rgb(var(--fg)); }

.nav-dropdown-chevron {
  transition: transform .2s ease;
  flex-shrink: 0;
}
.nav-dropdown:hover .nav-dropdown-chevron { transform: rotate(180deg); }

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 192px;
  background: rgb(var(--canvas));
  border: 1px solid rgb(var(--line));
  border-radius: 8px;
  padding: 12px 4px 4px; /* 12px top padding bridges the visual gap while keeping hover area connected */
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 200;
  box-shadow: 0 8px 24px rgb(var(--fg) / 0.08);
}
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
  display: block;
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 14px;
  letter-spacing: -0.003em;
  color: rgb(var(--fg) / 0.72);
  transition: background-color .1s ease, color .1s ease;
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  background-color: rgb(var(--fg) / 0.05);
  color: rgb(var(--fg));
}


/* ============================================================
   Ritual pages — timeline + step cards
   ============================================================ */

.ritual-timeline {
  display: flex;
  align-items: flex-start;
  margin-bottom: 48px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.ritual-timeline-step {
  flex: 1;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.ritual-timeline-step + .ritual-timeline-step::before {
  content: '';
  position: absolute;
  top: 13px;
  left: 0;
  right: 50%;
  width: 50%;
  height: 1px;
  background: rgb(var(--line));
  z-index: 0;
}

/* extend line to right toward next circle */
.ritual-timeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 13px;
  left: 50%;
  width: 50%;
  height: 1px;
  background: rgb(var(--line));
  z-index: 0;
}

.ritual-timeline-dot {
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  border: 1px solid rgb(var(--line));
  background: rgb(var(--canvas));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0;
  color: rgb(var(--fg));
  position: relative;
  z-index: 1;
}

.ritual-timeline-time {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  color: rgb(var(--muted));
  text-transform: uppercase;
  margin-top: 8px;
  text-align: center;
  line-height: 1.4;
  white-space: nowrap;
}

.ritual-timeline-label {
  font-size: 12px;
  color: rgb(var(--fg));
  text-align: center;
  margin-top: 8px;
  line-height: 1.3;
  padding: 0 4px;
}

.ritual-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 20px;
  padding: 24px 0;
  border-top: 1px solid rgb(var(--line));
}

.ritual-step-num {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(var(--muted));
  padding-top: 3px;
}

.ritual-step-tip {
  margin-top: 12px;
  padding: 12px 16px;
  border-left: 2px solid rgb(var(--line));
  font-size: 14px;
  color: rgb(var(--muted));
  line-height: 1.6;
}

.ritual-step-tip strong {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(var(--muted));
  display: block;
  margin-bottom: 6px;
}

/* ============================================================
   Project image slideshow — JS-controlled (supports video)
   Images: 0.55s each. Video: plays to end, then advances.
   ============================================================ */

.slideshow {
  position: relative;
  aspect-ratio: 16 / 9;
  background: rgb(var(--canvas));
  overflow: hidden;
  border: 1px solid rgb(var(--line) / 0.4);
  border-radius: 6px;
}
.slideshow img,
.slideshow video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
}
.slideshow video { object-fit: contain; }

@media (prefers-reduced-motion: reduce) {
  .slideshow img:first-child { opacity: 1; }
}

/* ============================================================
   Article prose
   ============================================================ */

.prose p {
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0.005em;
  color: rgb(var(--fg));
  margin-bottom: 1.5em;
}
.prose h2 {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: rgb(var(--fg));
  margin-top: 3em;
  margin-bottom: 1em;
  font-weight: 500;
}
.prose a {
  text-decoration: underline;
  text-decoration-color: rgb(var(--fg) / 0.20);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .2s ease;
}
.prose a:hover { text-decoration-color: rgb(var(--fg)); }
.prose blockquote {
  border-left: 1px solid rgb(var(--line));
  padding-left: 24px;
  margin: 2em 0;
  color: rgb(var(--muted));
  font-style: italic;
}

/* Reset letter-spacing in serif mode */
html.serif .prose p,
html.serif .prose h2,
html.serif .prose blockquote { letter-spacing: 0; }

/* ============================================================
   Case metadata grid + sections
   ============================================================ */

.meta-grid dt {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(var(--muted));
  line-height: 2;
}
.meta-grid dd {
  font-size: 14px;
  color: rgb(var(--fg));
  letter-spacing: 0.005em;
}

.case-section {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid rgb(var(--line));
}
.case-section:first-of-type { margin-top: 3rem; }

/* ============================================================
   Toggle buttons (theme + font) in nav
   ============================================================ */

.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  color: rgb(var(--fg) / 0.85);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}
.toggle-btn:hover {
  color: rgb(var(--fg));
  background-color: rgb(var(--fg) / 0.05);
  border-color: rgb(var(--line));
}
.toggle-btn:focus-visible {
  outline: 2px solid rgb(var(--accent));
  outline-offset: 2px;
}
.toggle-btn svg { width: 16px; height: 16px; }

/* ============================================================
   Language toggle — pt / es controlled by <html lang="pt|es">
   ============================================================ */

:root[lang="pt"] [lang="es"] { display: none; }
:root[lang="es"] [lang="pt"] { display: none; }

.lang-toggle {
  width: auto;
  padding: 0 10px;
  gap: 4px;
}
.lang-toggle .lang-opt {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: opacity .2s ease;
}
.lang-toggle .lang-sep {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px;
  opacity: 0.4;
}
:root[lang="pt"] .lang-toggle .lang-opt[data-lang="es"] { opacity: 0.4; }
:root[lang="es"] .lang-toggle .lang-opt[data-lang="pt"] { opacity: 0.4; }

/* Font toggle 'Aa' label tracks current font */
.font-btn-label {
  font-size: 13px;
  letter-spacing: -0.005em;
  font-family: 'Inter', sans-serif;
}
html.serif .font-btn-label {
  font-family: 'Newsreader', Georgia, serif;
  letter-spacing: 0;
}

/* ============================================================
   PDF download button
   ============================================================ */

.pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: rgb(var(--accent));
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: opacity .15s ease;
}
.pdf-btn:hover {
  opacity: 0.8;
}
.pdf-btn:active {
  opacity: 0.65;
}
.pdf-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* ============================================================
   Print / PDF styles
   ============================================================ */

@media print {
  /* Page margins */
  @page { margin: 1.5cm 2cm; size: A4; }

  /* Hide interactive chrome */
  nav,
  .gate-overlay,
  .pdf-btn,
  .toggle-btn,
  .nav-dropdown,
  footer a,
  .section-divider { display: none !important; }

  /* White background, dark text */
  :root {
    --canvas: 255 255 255;
    --fg:     10 10 10;
    --muted:  80 80 80;
    --line:   200 200 200;
    --accent: 37 99 235;
    --whisper: 150 150 150;
  }

  body {
    font-size: 11pt;
    background: #fff !important;
    color: #0a0a0a !important;
  }

  /* Preserve two-column grids */
  .grid-cols-2,
  .md\:grid-cols-2 { display: grid !important; grid-template-columns: 1fr 1fr !important; }
  .sm\:grid-cols-2 { display: grid !important; grid-template-columns: 1fr 1fr !important; }
  .sm\:grid-cols-3,
  .grid-cols-3     { display: grid !important; grid-template-columns: 1fr 1fr 1fr !important; }

  /* Meta-grid layout */
  .meta-grid { display: grid !important; grid-template-columns: 1fr 1fr 1fr !important; }

  /* Avoid page breaks inside cards and sections */
  .ritual-step,
  .p-5,
  .space-y-8 > div,
  .space-y-6 > div,
  .space-y-4 > div { break-inside: avoid; }

  section { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

  /* Strip link decorations */
  a[href]::after { content: none; }

  /* Status pills — readable in greyscale */
  .status-pill--desenvolvendo,
  .status-pill--identificado,
  .status-pill--resolvido {
    background-color: #f5f5f5 !important;
    color: #555 !important;
    border: 1px solid #ccc !important;
  }

  /* Avatar */
  img[style*="border-radius:9999px"],
  img[style*="border-radius: 9999px"] {
    width: 48px !important;
    height: 48px !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Borders visible in print */
  .border,
  .border-t,
  .border-b { border-color: #d1d5db !important; }

  /* Pill badge */
  .pill { border: 1px solid #d1d5db !important; color: #555 !important; background: #f9f9f9 !important; }
}
