/*
  Design system for diary.chnkukoolwal.vc.

  Shares its type pairing (Fraunces + Geist) and motion philosophy with
  chnkukoolwal.vc and notes.chnkukoolwal.vc, so this room reads as part
  of the same house — but the palette inverts to warm paper instead of
  dark bronze, and the ornament is a quiet photographic frame rather
  than a glass pill. Notes is intellectual; this is personal.
*/

/* ---------- Tokens ---------- */
:root {
  --c-bg: #f5f0e7;
  --c-bg-deep: #ece3d3;

  --c-ink: #2b2521;
  --c-ink-soft: #6b5f52;
  --c-ink-faint: rgba(43, 37, 33, 0.66);

  --c-accent: #c1592e;
  --c-accent-strong: #a5461f;

  --c-border: rgba(43, 37, 33, 0.12);
  --c-border-strong: rgba(43, 37, 33, 0.26);

  --c-selection: rgba(193, 89, 46, 0.2);
  --c-focus: var(--c-accent);

  --font-serif: "Fraunces", "Merriweather", Georgia, serif;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --gutter: clamp(1.25rem, 4vw, 3rem);

  --ease-reveal: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-quick: 220ms;
  --dur-reveal: 900ms;

  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { text-decoration: none; color: inherit; }
::selection { background: var(--c-selection); color: var(--c-ink); }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--c-accent);
  color: var(--c-bg);
  padding: 0.75rem 1.25rem;
  z-index: 200;
  font-size: 0.875rem;
}
.skip-link:focus { top: var(--space-2); }

/* ---------- Grain — paper texture, not a glow ----------
   A single static SVG turbulence layer at very low opacity.
   No animation: the page should feel still, like paper, not alive
   with movement. */
.grain {
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 340px 340px;
}

/* ---------- Identity mark — flat, no glass ---------- */
.top-bar {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  width: fit-content;
  margin: clamp(1.25rem, 3vh, 2.5rem) 0 0 var(--gutter);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-quick) var(--ease-soft);
}
.top-bar:hover, .top-bar:focus-visible {
  border-bottom-color: var(--c-border-strong);
}

.top-bar__word {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--c-ink);
  transition: color var(--dur-quick) var(--ease-soft);
}
.top-bar:hover .top-bar__word, .top-bar:focus-visible .top-bar__word { color: var(--c-accent-strong); }

.top-bar__sep { color: var(--c-ink-faint); font-size: 0.9rem; }

.top-bar__section {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--c-ink-soft);
}

/* ---------- Content ---------- */
.wrap {
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
  width: 100%;
}

.diary-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  padding-block: clamp(2.5rem, 10vh, 6rem) var(--space-8);
}

.diary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
  width: 100%;
}

@media (min-width: 860px) {
  .diary-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
}

.diary-hero { max-width: 33rem; }

.caption {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-ink-faint);
}

.diary-eyebrow { margin-bottom: clamp(1.1rem, 0.8rem + 1vw, 1.75rem); }

.diary-heading {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 460;
  font-size: clamp(2.3rem, 1.85rem + 2.3vw, 3.9rem);
  line-height: 1.16;
  letter-spacing: -0.005em;
  color: var(--c-ink);
}

.diary-divider {
  display: block;
  width: 3.5rem;
  height: 1px;
  background: var(--c-accent);
  transform-origin: left;
  opacity: 0;
  margin-block: clamp(1.5rem, 1rem + 2vw, 2.25rem) clamp(1.1rem, 0.9rem + 1vw, 1.5rem);
}

.diary-soon {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 460;
  font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.8rem);
  color: var(--c-accent-strong);
  margin-bottom: clamp(1.5rem, 1.1rem + 1.5vw, 2.25rem);
}

.lede {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  line-height: 1.7;
  color: var(--c-ink-soft);
  max-width: 34ch;
  margin-bottom: clamp(2rem, 1.4rem + 2.5vw, 3rem);
}

.diary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-6);
}

.text-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--c-ink);
  border-bottom: 1px solid var(--c-border-strong);
  padding-bottom: 0.05em;
  font-size: 0.9375rem;
  transition: color var(--dur-quick) var(--ease-soft), border-color var(--dur-quick) var(--ease-soft);
}
.text-link:hover, .text-link:focus-visible { color: var(--c-accent-strong); border-color: var(--c-accent-strong); }
.text-link .arrow { transition: transform var(--dur-quick) var(--ease-soft); }
.text-link:hover .arrow { transform: translateX(0.15em); }

.text-link--quiet {
  color: var(--c-ink-soft);
  border-bottom-color: var(--c-border);
  font-size: 0.875rem;
}
.text-link--quiet:hover, .text-link--quiet:focus-visible { color: var(--c-accent-strong); }
.text-link--quiet:hover .arrow { transform: translateX(-0.15em); }

/* ---------- Frame motif — a quiet empty photographic frame, not a fake
   photo. Fine rule border, corner registration marks, a single small
   stamp. One gesture, not a contact-sheet's worth — a companion to the
   text, never competing with it. Desktop/tablet only: on a phone the
   words alone should carry the page, so this stays hidden below the
   two-column breakpoint rather than displacing "DIARY" from being the
   first thing read. ---- */
.frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-width: 15rem;
  margin-inline: auto;
  border: 1px solid var(--c-border-strong);
  background: linear-gradient(155deg, var(--c-bg-deep) 0%, var(--c-bg) 60%);
  overflow: hidden;
}

.frame__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.frame__corner {
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  border: 1px solid var(--c-ink-soft);
}
.frame__corner--tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.frame__corner--tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.frame__corner--bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.frame__corner--br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.frame__stamp {
  position: absolute;
  bottom: var(--space-3);
  right: var(--space-3);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--c-accent);
  opacity: 0.55;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: var(--space-6);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.site-footer .meta {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--c-ink-soft);
}
.site-footer a:hover, .site-footer a:focus-visible { color: var(--c-accent); }

/* ---------- Entrance motion — a slow, still settle. Distances stay
   small; nothing bounces, nothing loops. ---------- */
.top-bar,
.diary-eyebrow,
.diary-heading,
.diary-soon,
.lede,
.diary-meta,
.frame,
.site-footer {
  animation: rise var(--dur-reveal) var(--ease-reveal) both;
}
.top-bar      { --rise-y: 10px; animation-delay: 0ms; }
.diary-eyebrow { --rise-y: 10px; animation-delay: 90ms; }
.diary-heading { --rise-y: 18px; animation-delay: 200ms; }
.diary-soon    { --rise-y: 12px; animation-delay: 430ms; }
.lede          { --rise-y: 12px; animation-delay: 560ms; }
.diary-meta    { --rise-y: 10px; animation-delay: 690ms; }
.frame         { --rise-y: 14px; animation-delay: 260ms; }
.site-footer   { --rise-y: 10px; animation-delay: 780ms; }

.diary-divider {
  animation: divider-draw 950ms var(--ease-reveal) both;
  animation-delay: 330ms;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(var(--rise-y, 12px)); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes divider-draw {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 0.8; transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .top-bar,
  .diary-eyebrow,
  .diary-heading,
  .diary-soon,
  .lede,
  .diary-meta,
  .frame,
  .site-footer,
  .diary-divider {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .top-bar { margin-left: var(--space-4); margin-right: var(--space-4); margin-top: var(--space-3); }
  .site-footer { padding-block: var(--space-5); }
  .diary-main { padding-block: var(--space-5) var(--space-6); }
}

/* Below the two-column breakpoint the frame is hidden rather than
   restacked above the text — on a phone, "DIARY" should be the first
   thing read, not a photographic ornament. */
@media (max-width: 859px) {
  .frame { display: none; }
}
