/* ============================================================
   WEBFONTS
   Zapf Humanist 601 is Bitstream's cut of Optima (a humanist
   sans). Optima ships on every Apple/iOS device, so the stack
   below already renders the intended look on most phones.
   To serve the licensed Zapf Humanist webfont everywhere, drop
   the files into /assets/fonts/ (see assets/fonts/README.md) —
   this @font-face will pick them up automatically.
   ============================================================ */
@font-face {
  font-family: 'Zapf Humanist 601';
  src: url('/assets/fonts/zapf-humanist-601.woff2') format('woff2'),
       url('/assets/fonts/zapf-humanist-601.woff')  format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   DESIGN TOKENS — sourced from Figma "website-template".
   All templates use these vars. No hardcoded values elsewhere.
   ============================================================ */
:root {
  /* Colors */
  --color-bg:          #FCFCFC;
  --color-surface:     #F4F4F2;
  --color-text:        #625C5C;
  --color-text-muted:  #C9C9C9;
  --color-accent:      #111111;
  --color-border:      rgba(0, 0, 0, 0.18);
  --color-border-strong: rgba(0, 0, 0, 0.4);
  --color-overlay-bg:  #111111;
  --color-overlay-text:#FCFCFC;
  --color-error:       #C0392B;

  /* Typography */
  --font-display:      'Zapf Humanist 601', 'Optima', 'Candara', 'Segoe UI', 'Helvetica Neue', sans-serif;
  --font-body:         'Zapf Humanist 601', 'Optima', 'Candara', 'Segoe UI', 'Helvetica Neue', sans-serif;
  --font-mono:         'Panchi Mono', 'Courier New', ui-monospace, monospace;

  --text-2xs:  0.625rem;  /* 10px */
  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.375rem;  /* 22px */
  --text-2xl:  1.75rem;   /* 28px */
  --text-3xl:  2.25rem;   /* 36px */

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-bold:    700;

  --leading-tight:  1.2;
  --leading-body:   1.6;
  --leading-loose:  1.8;

  /* Spacing (4px base) */
  --space-1:  0.25rem;  /* 4px  */
  --space-2:  0.5rem;   /* 8px  */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-5:  1.25rem;  /* 20px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */

  /* Layout */
  --max-width:     430px;
  --page-padding:  var(--space-6);

  /* Borders */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-card: 12px;

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

/* ============================================================
   DESKTOP BLOCK — shown on any device with a mouse (hover + fine
   pointer), regardless of window size. This catches desktops that
   shrink their window below a width breakpoint; phones/tablets
   (coarse pointer, no hover) pass through. No JS needed.
   ============================================================ */
.desktop-block {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-overlay-bg);
  color: var(--color-overlay-text);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8);
}

.desktop-block p {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  letter-spacing: 0.02em;
  opacity: 0.8;
}

@media (hover: hover) and (pointer: fine) {
  .desktop-block { display: flex; }
  main { display: none !important; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--page-padding);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   LANDING / SEARCH  — Figma "Landing page" (154:142)
   Quiet centered column: greeting, intro, name field, "let me in".
   ============================================================ */
.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;   /* center when it fits, scroll from top when it doesn't */
  gap: 0;
  padding-block: var(--space-8);
  text-align: center;
}

.landing__hello {
  font-family: var(--font-display);
  font-size: var(--text-sm);        /* 14px */
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

.landing__intro {
  font-family: var(--font-display);
  font-size: var(--text-xs);        /* 12px */
  line-height: 20px;
  color: var(--color-text);
  max-width: 285px;
  margin-bottom: var(--space-16);   /* breathing room before the field */
}

.landing__form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  width: 100%;
}

.landing__input {
  width: 250px;
  height: 29px;
  border: 1px solid var(--color-border);
  border-bottom-color: var(--color-border-strong);
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);       /* 10px */
  text-align: center;
  padding: 0 var(--space-3);
  outline: none;
  transition: border-color var(--transition-fast);
}

.landing__input:focus {
  border-bottom-color: var(--color-text);
}

.landing__input::placeholder {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.landing__password-group {
  display: none;
  width: 100%;
  justify-content: center;
}

.landing__password-group.visible {
  display: flex;
  animation: fadeIn var(--transition-normal) forwards;
}

.landing__submit {
  background: none;
  border: none;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-xs);        /* 12px */
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: var(--space-1);
  transition: opacity var(--transition-fast);
}

.landing__submit:hover { opacity: 0.6; }
.landing__submit:disabled { opacity: 0.4; cursor: not-allowed; }

.landing__message {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  min-height: 1.2em;
  margin-top: var(--space-4);
  transition: opacity var(--transition-normal);
}

.landing__message--error {
  color: var(--color-error);
}

/* ============================================================
   VERIFICATION  — Figma "Verification" (163:159)
   Same centered column as the landing: bold greeting, "do you
   remember,", the question (+ optional format hint), answer field.
   ============================================================ */
.verify__hello {
  font-family: var(--font-display);
  font-size: var(--text-sm);        /* 14px */
  font-weight: var(--weight-bold);
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.verify__remember {
  font-family: var(--font-display);
  font-size: var(--text-xs);        /* 12px */
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.verify__question {
  font-family: var(--font-display);
  font-size: var(--text-xs);        /* 12px */
  line-height: 20px;
  color: var(--color-text);
  max-width: 285px;
  margin-bottom: var(--space-16);
}

.verify__hint {
  color: var(--color-text);
}

/* ============================================================
   PAGE-TRANSITION LOADER  — spinning monkey, 5s, on every nav
   ============================================================ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-fast) forwards;
}

.loader__img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .loader__img { animation-duration: 3s; }
}

/* ============================================================
   HUB / DECK
   ============================================================ */
.hub__header {
  padding-top: var(--space-12);
  padding-bottom: var(--space-8);
}

.hub__greeting {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

.hub__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  padding-bottom: var(--space-16);
}

.card-tile {
  border-radius: var(--radius-card);
  background: var(--color-surface);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  display: block;
}

.card-tile:active { transform: scale(0.97); }

.card-tile__cover {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--color-border);
}

.card-tile__cover--placeholder {
  aspect-ratio: 4/3;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-tile__cover--placeholder .card-tile__type-icon {
  font-size: var(--text-2xl);
}

.card-tile__body {
  padding: var(--space-3);
}

.card-tile__type {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.card-tile__title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
}

/* ============================================================
   CARD CONTENT — shared across all card templates
   ============================================================ */
.card-content {
  padding-top: var(--space-12);
  padding-bottom: var(--space-20);
}

.card-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  cursor: pointer;
}

.card-back::before { content: '←'; }

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-8);
}

/* Rich content blocks */
.blocks p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-loose);
}

.blocks h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  line-height: var(--leading-tight);
}

.blocks h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.blocks h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

.blocks ul, .blocks ol {
  padding-left: var(--space-5);
  margin-bottom: var(--space-4);
}

.blocks li { margin-bottom: var(--space-2); }

.blocks figure {
  margin: var(--space-6) 0;
}

.blocks figure img {
  width: 100%;
  border-radius: var(--radius-md);
}

.blocks figcaption {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  text-align: center;
}

.blocks .callout {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-4) 0;
  display: flex;
  gap: var(--space-3);
  line-height: var(--leading-body);
}

.blocks hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* ============================================================
   LETTER TEMPLATE
   ============================================================ */
.letter .card-title,
.letter .blocks p,
.letter .blocks h1 {
  font-family: var(--font-display);
}

.letter .blocks p {
  font-size: var(--text-lg);
}

/* ============================================================
   ALBUM TEMPLATE
   ============================================================ */
.album .card-title { margin-bottom: var(--space-6); }

.album .blocks figure img {
  border-radius: 0;
  width: calc(100% + var(--page-padding) * 2);
  margin-left: calc(var(--page-padding) * -1);
}

/* ============================================================
   TRAVEL TEMPLATE
   ============================================================ */
.travel .blocks h2 {
  font-family: var(--font-display);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
}

/* ============================================================
   LOADING STATE
   ============================================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40dvh;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
