/* Mantel: the room carries the emotion, the archive carries everything else.
   Colours and type are the app's own (Theme.swift). */

@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/CormorantGaramond.ttf") format("truetype"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope.ttf") format("truetype"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/fonts/Caveat.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Homemade Apple"; src: url("/fonts/HomemadeApple-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "La Belle Aurore"; src: url("/fonts/LaBelleAurore.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Nothing You Could Do"; src: url("/fonts/NothingYouCouldDo.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Dancing Script"; src: url("/fonts/DancingScript.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Mrs Saint Delafield"; src: url("/fonts/MrsSaintDelafield-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Kalam"; src: url("/fonts/Kalam-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Klee One"; src: url("/fonts/KleeOne-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --room: #16100B;
  --room-deep: #0C0704;
  --ember: #B4622A;
  --candle: #F8E1B7;
  --paper: #EAE1CF;
  --paper-shade: #BEAE9D;
  --print-ink: #3A2E26;
  --hand-ink: #2F3D6E;
  --label: #D9CBB2;
  --label-bright: #F3EBDB;
  --burgundy: #6A1C2A;
  --env-paper: #EAE2D2;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", -apple-system, "Helvetica Neue", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(20px, 5vw, 72px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--room-deep); color: var(--label-bright); font-family: var(--sans); font-size: 16px; line-height: 1.55;
       -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: rgba(180, 98, 42, .35); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }

.serif { font-family: var(--serif); }
.label { font-family: var(--serif); font-weight: 500; text-transform: uppercase; letter-spacing: .28em; font-size: 11px; color: var(--label); }
.dim { color: rgba(243, 235, 219, .74); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* MARK: Header */
.site-head { position: fixed; inset: 0 0 auto 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
             padding: 22px var(--gutter); pointer-events: none; transition: background .5s var(--ease-out), backdrop-filter .5s; }
.site-head > * { pointer-events: auto; }
.site-head.scrolled { background: linear-gradient(rgba(12, 7, 4, .72), rgba(12, 7, 4, 0)); }
.site-head.on-light { background: linear-gradient(rgba(234, 225, 207, .9), rgba(234, 225, 207, 0)); }
.site-head.on-light .wordmark, .site-head.on-light nav a:not(.store) { color: var(--print-ink); }
.site-head.on-light .store { background: var(--print-ink); color: var(--paper) !important; }
.site-head .wordmark, .site-head nav a, .site-head .store { transition: color .4s, background .4s; }
.wordmark { font-family: var(--serif); font-weight: 500; font-size: 22px; letter-spacing: .32em; text-transform: uppercase; text-decoration: none; color: var(--label-bright); }
.site-head nav { display: flex; gap: 30px; align-items: center; }
.site-head nav a { font-size: 14px; text-decoration: none; color: rgba(243, 235, 219, .82); transition: color .3s; }
.site-head nav a:hover { color: var(--label-bright); }
@media (max-width: 720px) { .site-head nav a:not(.store), .site-head nav .store { display: none; } }

/* The App Store button: a quiet, filled pill, the app's own (Pill in ScanFlowView). */
.store { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; padding: 11px 20px; border-radius: 999px; background: var(--label-bright);
         color: var(--print-ink) !important; font-family: var(--serif); font-weight: 600; font-size: 17px; text-decoration: none;
         transition: transform .4s var(--ease-out), background .3s; }
.store:hover { transform: translateY(-1px) scale(1.02); background: #fff; }
.store svg { width: 16px; height: 16px; }
.store.soon { cursor: default; }
.link-quiet { font-size: 14px; color: rgba(243, 235, 219, .82); text-decoration: none; border-bottom: .5px solid rgba(243, 235, 219, .4); padding-bottom: 2px; }
.link-quiet:hover { color: var(--label-bright); border-color: var(--label-bright); }

/* MARK: The room
   Each plate is a Blender render of a plaster wall over an oak mantel. --line is where cards stand,
   as a fraction of the plate's height (RoomPlate.cardLine). */
.room { position: relative; overflow: hidden; background: var(--room); }
.room > .plate { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% var(--line-pos, 70%); }
.room .light { position: absolute; inset: 0; pointer-events: none;
               background: radial-gradient(ellipse 46% 60% at 50% 58%, rgba(248, 225, 183, .16), transparent 70%),
                           radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, .2), rgba(0, 0, 0, .62)); }
.room.day .light { background: radial-gradient(ellipse 60% 70% at 30% 40%, rgba(255, 250, 235, .2), transparent 70%); }

.shelf { position: absolute; left: 0; right: 0; display: flex; justify-content: center; align-items: flex-end; gap: calc(var(--h) * .09);
         height: var(--h); }
.standing { position: relative; height: calc(var(--h) * var(--scale, 1)); aspect-ratio: 5 / 7; transform-origin: 50% 100%; }
.standing .face { position: absolute; inset: 0; border-radius: 2px; overflow: hidden; background: var(--paper);
                  box-shadow: 0 .5px 1px rgba(0, 0, 0, .3); }
.standing::before { content: ""; position: absolute; inset: 0; border-radius: 2px; background: rgba(0, 0, 0, .5);
                    transform: translate(7%, -1.5%); filter: blur(calc(var(--h) * .035)); }
.room.day .standing::before { background: rgba(0, 0, 0, .16); transform: translate(-5%, -1.5%); }
.standing.dim .face::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .34); }
.standing a, .standing button { all: unset; position: absolute; inset: 0; cursor: pointer; border-radius: 2px; }
.standing a:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }
.candle { position: relative; height: calc(var(--h) * .42); aspect-ratio: 1 / 3; margin-left: calc(var(--h) * .05); }
.candle img { width: 100%; height: 100%; }
.candle .flame { position: absolute; left: 50%; top: 11.9%; width: 16%; aspect-ratio: .42; transform: translate(-50%, -70%);
                 border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
                 background: radial-gradient(ellipse at 50% 72%, #fff 0%, #FFD89A 32%, rgba(240, 138, 46, .85) 62%, transparent 72%); filter: blur(.4px); }
.candle .glow { position: absolute; left: 50%; top: 11.9%; width: 300%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
                background: radial-gradient(circle, rgba(248, 225, 183, .4), rgba(248, 225, 183, .07) 45%, transparent 70%); pointer-events: none; }

/* MARK: Faces and paper */
.face { position: relative; overflow: hidden; background: var(--paper); }
.face img { width: 100%; height: 100%; object-fit: cover; }
.face.stock { background: linear-gradient(rgba(0, 0, 0, .06), transparent 40%, rgba(255, 255, 255, .05)), var(--paper); }
.face .stock-mark { position: absolute; left: 50%; top: 50%; width: 3%; aspect-ratio: 1; background: var(--paper-shade); transform: translate(-50%, -50%) rotate(45deg); }
/* The thickness of card stock: its top edge catching the light, its lower edge in shade (PaperEdge). */
.face .edge { position: absolute; inset: 0; pointer-events: none;
              box-shadow: inset 0 .75px 0 rgba(255, 255, 255, .22), inset 0 -.75px 0 rgba(0, 0, 0, .18),
                          inset .5px 0 0 rgba(255, 255, 255, .1), inset -.5px 0 0 rgba(0, 0, 0, .1); }
.face .sheen { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
               background: linear-gradient(135deg, transparent calc((var(--sheen, .5) - .3) * 100%), rgba(255, 255, 255, .1) calc(var(--sheen, .5) * 100%), transparent calc((var(--sheen, .5) + .3) * 100%)); }

.written { position: absolute; inset: 0; padding: 12% 10% 8%; container-type: inline-size; display: flex; flex-direction: column; gap: 4cqw; }
.written .message { margin: 0; font-family: var(--hand), cursive; font-size: calc(7.8cqw * var(--hand-scale, 1)); line-height: 1.3;
                    color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.written .signature { max-width: 50%; max-height: 22cqw; object-fit: contain; object-position: left; filter: none; }

/* MARK: A card that opens like a book */
.book-stage { perspective: 2400px; perspective-origin: 50% 40%; }
.book { --w: 280px; position: relative; width: var(--w); aspect-ratio: 5 / 7; transform-style: preserve-3d;
}
/* Keeps the open spread centred where the closed card stood. It's on an inner layer, so animations of the card
   itself never undo it. */
.book .spread { position: absolute; inset: 0; transform-style: preserve-3d; transform: translateX(calc(var(--w) * .5 * var(--open, 0))); }
.book .spread > .face, .book .cover > .face { position: absolute; inset: 0; border-radius: 2px; }
.book .inside-right { box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.book .cover { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; will-change: transform; }
.book .cover .face { backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.book .cover .inside-left { transform: rotateY(180deg); }
.book .cover-shadow { position: absolute; inset: 0; background: #000; pointer-events: none; }
.book .crease-shade { position: absolute; top: 0; bottom: 0; width: 9%; pointer-events: none; }
.book .crease-shade.left { left: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .16), transparent); }
.book .crease-shade.right { right: 0; background: linear-gradient(-90deg, rgba(0, 0, 0, .16), transparent); }

/* MARK: The envelope (EnvelopeView) */
.envelope { --w: 380px; position: relative; width: var(--w); aspect-ratio: 100 / 71; perspective: 900px; }
.envelope .env-back { position: absolute; inset: 0; border-radius: 3px; background: #E1D7C4; box-shadow: 0 calc(var(--w) * .06) calc(var(--w) * .12) rgba(0, 0, 0, .55); }
.envelope .env-slot { position: absolute; inset: 0 0 auto 0; height: 2px; background: rgba(0, 0, 0, .12); }
.envelope .env-body { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; }
.envelope .env-name { position: absolute; z-index: 4; left: 0; right: 0; top: 71%; text-align: center; font-size: calc(var(--w) * .075 * var(--hand-scale, 1)); line-height: 1; }
.envelope .env-flap { position: absolute; z-index: 5; left: 0; top: 0; width: 100%; height: 55%; transform-origin: 50% 0; transform: rotateX(0deg);
                      filter: drop-shadow(0 1.4px 1.4px rgba(0, 0, 0, .22)); backface-visibility: visible; }
.envelope .seal { position: absolute; z-index: 6; left: 50%; top: calc(55% - var(--w) * .095 - var(--w) * .012 + var(--w) * .0); width: 19%; aspect-ratio: 1;
                  transform: translate(-50%, 0); border-radius: 50%; display: grid; place-items: center;
                  background: radial-gradient(circle at 38% 32%, #8E2A36, var(--burgundy) 55%, #4A111B);
                  box-shadow: 0 calc(var(--w) * .008) calc(var(--w) * .012) rgba(0, 0, 0, .35), inset 0 0 0 calc(var(--w) * .011) rgba(0, 0, 0, .22); }
.envelope .seal span { font-family: var(--serif); font-weight: 600; font-size: calc(var(--w) * .087); color: rgba(62, 13, 22, .85);
                       text-shadow: 0 calc(var(--w) * .003) 0 rgba(255, 255, 255, .18); }
.envelope .letter { position: absolute; z-index: 2; left: 50%; bottom: 4%; width: 42%; aspect-ratio: 5 / 7; transform: translateX(-50%); }
.envelope .letter .face { position: absolute; inset: 0; box-shadow: 0 4px 8px rgba(0, 0, 0, .25); border-radius: 2px; }

/* MARK: Type */
.display { font-family: var(--serif); font-weight: 400; line-height: 1.02; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.display.xl { font-size: clamp(44px, 7.2vw, 108px); }
.display.l { font-size: clamp(36px, 4.6vw, 72px); }
.display.m { font-size: clamp(28px, 3vw, 44px); }
.lede { font-size: clamp(16px, 1.25vw, 19px); max-width: 34em; color: rgba(243, 235, 219, .8); margin: 0; }
.hand-note { font-family: "Caveat", cursive; color: var(--hand-ink); }

/* MARK: Legal and support pages: the archive's quiet voice */
.document { max-width: 680px; margin: 0 auto; padding: 150px var(--gutter) 120px; }
.document h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5vw, 60px); margin: 0 0 10px; line-height: 1.05; }
.document .updated { margin: 0 0 54px; }
.document h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 48px 0 10px; }
.document p, .document li { color: rgba(243, 235, 219, .84); }
.document ul { padding-left: 1.2em; }
.document li { margin: 6px 0; }
.document a { color: var(--label-bright); text-decoration-color: rgba(243, 235, 219, .4); text-underline-offset: 3px; }
.document dl { margin: 0; }
.document dt { font-family: var(--serif); font-size: 21px; color: var(--label-bright); margin-top: 30px; }
.document dd { margin: 6px 0 0; color: rgba(243, 235, 219, .84); }
.hairline { height: .5px; background: rgba(243, 235, 219, .25); border: 0; margin: 0; }

/* MARK: Footer */
.site-foot { position: relative; padding: 64px var(--gutter) 46px; background: var(--room-deep); display: flex; flex-wrap: wrap; gap: 26px 48px;
             align-items: baseline; justify-content: space-between; border-top: .5px solid rgba(243, 235, 219, .14); }
.site-foot nav { display: flex; gap: 28px; flex-wrap: wrap; }
.site-foot a { font-size: 14px; color: rgba(243, 235, 219, .74); text-decoration: none; }
.site-foot a:hover { color: var(--label-bright); }
.site-foot .small { font-size: 13px; color: rgba(243, 235, 219, .5); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
