/* The contact page (/hello/): the visitor writes on the studio wall, and Ömür reads along from his desk.
   Its HTML is src/cinematic/contact-page.ts, its behaviour src/cinematic/contact-wall.ts.

   Two layouts of the same form:
   on the wall   body[data-wall]: .plane is glued to the wall's recess by a matrix (960 × 676 at 200 px a metre;
                 .narrow on a phone, 370 × 453), first on a still picture of the room laid in the very same frame
                 (.room), then on the live studio drawn over it (body[data-live]). Sizes here are the wall's own
                 pixels: on a small window the wall is small, and --k (set by the script) keeps the small type readable.
   as a page     everything else (no scripts, a window too small to read the wall in): the same form in a column
                 over the room's soft still. It scrolls.
   The actions are the site's brass ring (buttons.css). */
:root {
  color-scheme:dark;
  --wall:#3d5957; --cream:#f1e7d5; --wall-cream:#eadfc9; --brass:#d2a567; --night:#152a2e;
  --serif:'Cormorant Garamond',Georgia,serif; --sans:'DM Sans',system-ui,sans-serif; --out:cubic-bezier(.16,1,.3,1);
}
* { box-sizing:border-box; }
html { background:var(--wall); }
html:has(body[data-wall]) { overflow:hidden; }
body { margin:0; min-height:100svh; color:var(--wall-cream); font:400 16px/1.5 var(--sans); -webkit-font-smoothing:antialiased; }
button,input,textarea { font:inherit; color:inherit; }
button { -webkit-tap-highlight-color:transparent; }
a { color:inherit; }
[hidden] { display:none!important; }
::selection { background:var(--brass); color:var(--night); }
:focus-visible { outline:2px solid var(--brass); outline-offset:4px; border-radius:6px; }
.skip-link { position:fixed; left:24px; top:16px; z-index:10; padding:12px 20px; border-radius:999px; background:var(--cream); color:#1d3335; transform:translateY(-250%); }
.skip-link:focus { transform:none; }

/* The room: a still of it (soft for the plain page; the script lays the sharp one in the wall's frame), and the live
   studio over that once it has drawn. */
.room { position:fixed; inset:0; z-index:0; background:var(--wall) url('/cinematic/work/room/room-blur.webp') 50% 50% / cover no-repeat; }
#room { position:fixed; inset:0; z-index:1; display:block; width:100%; height:100%; opacity:0; visibility:hidden; transition:opacity .6s,visibility 0s .6s; }
body[data-wall][data-live] #room { opacity:1; visibility:visible; transition:opacity .6s; }

.nav { position:fixed; inset:max(22px,env(safe-area-inset-top)) max(28px,env(safe-area-inset-right)) auto max(28px,env(safe-area-inset-left)); z-index:5; display:flex; justify-content:space-between; align-items:center; pointer-events:none; font-size:14.5px; }
.nav a { pointer-events:auto; display:inline-flex; align-items:center; gap:12px; min-height:42px; color:var(--cream); font-weight:500; letter-spacing:.02em; text-decoration:none; text-shadow:0 1px 12px #0d2424cc; transition:color .25s; }
.nav a:hover { color:#dcbb94; }
.nav .language-switch { position:static; flex-shrink:0; font-size:inherit; letter-spacing:0; }
.nav .language-switch a { min-height:42px; margin:0 -14px 0 0; padding:0 14px; opacity:.9; }
@media (max-width:420px) { .nav { inset:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) auto max(12px,env(safe-area-inset-left)); font-size:12.5px; } .nav a { gap:8px; min-height:44px; --ring-size:26px; } .nav .language-switch a { margin-right:-8px; padding:0 8px; } }

/* ── The letter (both layouts) ── */
.label { flex:none; font:500 max(13px,calc(10px * var(--k,1)))/1.4 var(--sans); letter-spacing:.24em; text-transform:uppercase; color:var(--brass); }
/* It waits for the script to put it on the wall (a moment). If the script never answers, it comes anyway. */
.plane { position:relative; z-index:2; opacity:0; animation:arrive .6s 2.5s forwards; }
body[data-in] .plane { opacity:1; animation:none; transition:opacity .5s; }
@keyframes arrive { to { opacity:1; } }
.wall-form h1 { margin:0; font:300 70px/1 var(--serif); letter-spacing:.005em; }
.wall-lead { margin:10px 0 0; font-size:max(17.5px,calc(12.5px * var(--k,1))); line-height:1.45; color:#eadfc9e0; }
/* What it is about: a word to tap, never required. */
.about { display:flex; align-items:baseline; gap:16px; margin:20px 0 12px; }
.kinds { display:flex; flex-wrap:wrap; gap:2px 22px; }
.kinds button { position:relative; padding:0 0 2px; border:0; background:none; cursor:pointer; font:italic 400 26px/1.2 var(--serif); opacity:.66; box-shadow:0 1px 0 #eadfc947; transition:opacity .3s; }
.kinds button:hover { opacity:.9; }
.kinds button[aria-checked=true] { opacity:1; box-shadow:none; }
.kinds button::after { content:''; position:absolute; left:0; right:0; bottom:0; height:1.5px; background:var(--brass); transform:scaleX(0); transform-origin:0 50%; transition:transform .7s var(--out); }
.kinds button[aria-checked=true]::after { transform:none; }
.wall-message { display:block; width:100%; margin:0; padding:0; border:0; border-radius:0; background:none; outline:none; resize:none; scrollbar-width:none; font:300 calc(var(--fit,31) * 1px)/1.22 var(--serif); caret-color:var(--brass); overflow-wrap:anywhere; }
.wall-message::-webkit-scrollbar { display:none; }
.wall-message::placeholder { color:inherit; font-style:italic; opacity:.6; }
.wall-sign { display:grid; gap:2px; }
.wall-sign label { display:grid; grid-template-columns:max(98px,calc(72px * var(--k,1))) 1fr; align-items:baseline; border-bottom:1px solid #eadfc966; transition:border-color .25s; }
.wall-sign label:focus-within { border-color:var(--brass); }
.wall-sign input { width:100%; min-width:0; padding:8px 0 7px; border:0; border-radius:0; background:none; outline:none; font:400 max(19px,calc(15px * var(--k,1)))/1.3 var(--sans); caret-color:var(--brass); }
.wall-sign input::placeholder { color:#eadfc98c; }
/* A person's browser may fill these in: they stay the wall's colour. */
.wall-sign input:-webkit-autofill { -webkit-text-fill-color:var(--wall-cream); caret-color:var(--brass); transition:background-color 99999s; }
.wall-sign .wall-trap { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); border:0; }
.wall-send { --ring-size:42px; justify-self:start; display:inline-flex; align-items:center; gap:14px; margin-top:16px; padding:0; border:0; background:none; cursor:pointer; font:300 33px/1 var(--serif); transition:color .25s; }
.wall-send:hover { color:#f6eddd; }
[data-busy] .wall-send { pointer-events:none; }
[data-busy] .wall-send .ring { border-top-color:#0000; animation:turn 1s linear infinite; }
[data-busy] .wall-send .ring::before { opacity:0; }
@keyframes turn { to { rotate:360deg; } }
.wall-note { min-height:20px; margin:8px 0 0; font-size:max(13.5px,calc(11.5px * var(--k,1))); line-height:1.4; color:var(--brass); }
.wall-direct { margin:14px 0 0; font-size:14px; color:#eadfc9c7; }
.wall-direct a,.wall-else a { text-decoration-color:var(--brass); text-underline-offset:4px; }
.wall-done h2 { margin:0 0 12px; font:300 76px/1 var(--serif); }
.wall-done p { margin:0 0 22px; max-width:520px; font:300 29px/1.25 var(--serif); opacity:.86; }
.wall-done .wall-else { font:400 max(15px,calc(12.5px * var(--k,1)))/1.5 var(--sans); }
.wall-done button { padding:0 0 3px; border:0; border-bottom:1px solid var(--brass); background:none; cursor:pointer; font-size:max(15px,calc(12.5px * var(--k,1))); }
.ink { animation:ink 1.1s var(--out) both; }
@keyframes ink { from { opacity:0; filter:blur(8px); transform:translateY(8px); } }

/* ── As a page ── */
body:not([data-wall]) .plane { width:min(560px,100% - 44px); margin:0 auto; padding:clamp(92px,16svh,150px) 0 56px; }
body:not([data-wall]) .wall-form h1 { font-size:clamp(46px,11vw,70px); }
body:not([data-wall]) .about { flex-wrap:wrap; gap:6px 16px; }
body:not([data-wall]) .kinds button { font-size:24px; line-height:1.5; }
body:not([data-wall]) .wall-message { min-height:150px; padding:10px 0; border-bottom:1px solid #eadfc966; font-size:26px; overflow:auto; }
body:not([data-wall]) .wall-message:focus { border-color:var(--brass); }
body:not([data-wall]) .wall-sign { margin-top:14px; }
body:not([data-wall]) .wall-sign input { padding:11px 0 10px; }
body:not([data-wall]) .wall-send { margin-top:24px; }
body:not([data-wall]) .wall-done h2 { font-size:clamp(46px,11vw,76px); }
body:not([data-wall]) .wall-done p { font-size:25px; }

/* ── On the wall ── */
body[data-wall] .plane { position:fixed; left:0; top:0; width:960px; height:676px; transform-origin:0 0; will-change:transform; }
/* The message takes what the lines above it leave, down to the signature. */
body[data-wall] .wall-write { position:absolute; left:204px; right:36px; top:30px; height:400px; display:flex; flex-direction:column; }
body[data-wall] .wall-write > * { flex:none; }
body[data-wall] .wall-message { flex:0 1 226px; min-height:0; }
body[data-wall] .wall-sign { position:absolute; left:204px; top:436px; width:330px; }
/* His address is in the answer if the mail app does not open; the wall keeps to the letter. */
body[data-wall] .wall-direct { display:none; }
body[data-wall] .wall-done { position:absolute; left:204px; right:36px; top:60px; }

body[data-wall] .plane.narrow { width:370px; height:453px; }
.plane.narrow .wall-write { left:12px; right:12px; top:10px; height:204px; }
.plane.narrow .wall-form h1 { font-size:40px; }
.plane.narrow .wall-lead { margin-top:4px; font-size:max(13px,calc(12px * var(--k,1))); }
.plane.narrow .about { gap:10px; margin:10px 0 6px; }
.plane.narrow .about .label { display:none; }
.plane.narrow .kinds { gap:2px 13px; }
.plane.narrow .kinds button { font-size:19px; }
/* A finger needs more than a line of type: the word is touched a little around itself. */
.plane.narrow .kinds button::before { content:''; position:absolute; inset:-5px -6px; }
.plane.narrow .wall-message { flex-basis:79px; font-size:21px; }
.plane.narrow .wall-sign { left:12px; right:12px; top:218px; width:auto; grid-template-columns:1fr 1fr; gap:4px 14px; }
.plane.narrow .wall-sign label { grid-template-columns:1fr; }
.plane.narrow .wall-sign .label { display:none; }
.plane.narrow .wall-sign input { font-size:max(16px,calc(15.5px * var(--k,1))); }
.plane.narrow .wall-send { --ring-size:34px; grid-column:1/-1; margin-top:8px; font-size:26px; }
.plane.narrow .wall-note { grid-column:1/-1; margin:2px 0 0; font-size:max(12.5px,calc(11.5px * var(--k,1))); }
.plane.narrow .wall-done { left:12px; right:12px; top:22px; }
.plane.narrow .wall-done h2 { font-size:46px; }
.plane.narrow .wall-done p { margin-bottom:14px; font-size:22px; }

/* ── The way in (src/cinematic/hello-passage.ts, played by contact-wall.ts) ──
   The room is held until the script has laid it in its frame; if the script never answers, it comes anyway.
   'pull': the whole picture starts close on him, his head where it was on the page the visitor came from
   (--hello-s, --hello-x, --hello-y), and pulls back to the wall. 'there': the camera has arrived already (the home
   page's own crane). Either way the letter is written on the wall line by line (--hello-ink: when), the bar last.
   --hello-wait: the picture holds still that long first, while two pages dissolve. */
html:not([data-arrive]) :is(.room,.nav) { opacity:0; animation:arrive .6s 2.5s forwards; }
html[data-arrive='hold'] :is(.room,.nav,.plane) { opacity:0; transition:none; animation:none; }
html:is([data-arrive='pull'],[data-arrive='there']) .room { animation:hello-pull var(--hello-pull,0s) cubic-bezier(.45,0,.12,1) var(--hello-wait,0s) both,hello-show var(--hello-show,.3s) ease both; }
html:is([data-arrive='pull'],[data-arrive='there']) #room { transform-origin:0 0; animation:hello-pull var(--hello-pull,0s) cubic-bezier(.45,0,.12,1) var(--hello-wait,0s) both; }
html:is([data-arrive='pull'],[data-arrive='there']) .plane { opacity:1; transition:none; animation:hello-pull var(--hello-pull,0s) cubic-bezier(.45,0,.12,1) var(--hello-wait,0s) both; }
html:is([data-arrive='pull'],[data-arrive='there']) :is(.wall-write,.wall-sign) > * { animation:hello-ink 1.05s var(--out) both; animation-delay:calc(var(--hello-ink,.1s) + var(--i,0) * 75ms); }
html:is([data-arrive='pull'],[data-arrive='there']) .nav { animation:hello-show .7s ease both; animation-delay:calc(var(--hello-ink,.1s) + .4s); }
.wall-write > :nth-child(2) { --i:1; } .wall-write > :nth-child(3) { --i:2; } .wall-write > :nth-child(4) { --i:3; }
.wall-sign > :nth-child(1) { --i:4; } .wall-sign > :nth-child(2) { --i:5; } .wall-sign > :nth-child(n+3) { --i:6; } .wall-sign > :nth-child(n+5) { --i:7; }
@keyframes hello-pull { from { translate:var(--hello-x,0) var(--hello-y,0); scale:var(--hello-s,1); } }
@keyframes hello-show { from { opacity:0; } }
@keyframes hello-ink { from { opacity:0; filter:blur(7px); translate:0 10px; } }
/* A page that asks for it on leaving (the home page after its crane, a project page) dissolves into this one:
   the old picture holds a moment, so this one has drawn its room before it shows through. */
@view-transition { navigation:auto; }
::view-transition-old(root) { animation:hello-old .5s ease .12s both; }
::view-transition-new(root) { animation:hello-show .5s ease .12s both; }
@keyframes hello-old { to { opacity:0; } }

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01s!important; transition-duration:.01s!important; }
  [data-busy] .wall-send .ring { animation:none; opacity:.5; }
  @view-transition { navigation:none; }
}

/* Contact delivery: a visible challenge only when Turnstile needs interaction. */
.wall-check { width:100%; max-width:100%; margin-top:8px; }
.wall-check:empty { display:none; }
.wall-privacy { margin:10px 0 0; font:400 11px/1.5 var(--sans,Arial,sans-serif); opacity:.8; }
