/* The front: one screen, a plain page, in one of five looks (data-look on <html>, set by look.js; none is Glass).
   Kept to what front.js can also draw by hand on a 2D canvas when the browser cannot hand it a picture of the page:
   flat grounds, borders, round corners, one photograph and type. No shadows, gradients, transforms or pseudo-elements
   on anything inside .front. */
@font-face{font-family:"Inter";font-style:normal;font-weight:100 900;font-display:swap;src:url("/assets/fonts/inter-latin.woff2") format("woff2")}
@font-face{font-family:"Instrument Serif";font-style:italic;font-weight:400;font-display:swap;src:url("/assets/fonts/instrument-serif-italic-latin.woff2") format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:100 800;font-display:swap;src:url("/assets/fonts/jetbrains-mono-latin.woff2") format("woff2")}
@font-face{font-family:"Anton";font-style:normal;font-weight:400;font-display:swap;src:url("/assets/fonts/anton-latin.woff2") format("woff2")}

:root{
  --bg:#fff; --ink:#111114; --dim:#55555e; --line:#e2e2e6; --focus:#1a5fff;
  --play-bg:#111114; --play-ink:#fff; --play-line:#111114;
  --font:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; --name-font:var(--font);
  --name-weight:650; --name-track:-.035em; --name-style:normal; --name-case:none;
  --link-weight:500; --link-size:15px; --link-track:0; --link-case:none; --say-size:15px;
  --photo-r:6px; --row:44px;
}
html[data-look="silk"]{
  --bg:#efe6d6; --ink:#2b2440; --dim:#5c5470; --line:#cfc3ae; --focus:#6a3fd0;
  --play-bg:#efe6d6; --play-ink:#2b2440; --play-line:#2b2440;
  --name-font:"Instrument Serif","Iowan Old Style","Palatino Linotype",Georgia,serif; --name-weight:400; --name-track:-.01em; --name-style:italic;
  --photo-r:2px;
}
html[data-look="burn"]{
  --bg:#f3ead7; --ink:#2a2018; --dim:#5e4f40; --line:#2a2018; --focus:#a23b00;
  --play-bg:#2a2018; --play-ink:#f3ead7; --play-line:#2a2018;
  --font:"Iowan Old Style","Palatino Linotype",Palatino,"Book Antiqua",Georgia,serif; --name-weight:400; --name-track:.16em; --name-case:uppercase;
  --link-weight:400; --link-size:16px; --say-size:16px; --photo-r:0px;
}
html[data-look="fall"]{
  color-scheme:dark;
  --bg:#0b0e14; --ink:#eef1f6; --dim:#9aa4b5; --line:#2b3344; --focus:#ffc233;
  --play-bg:#ffc233; --play-ink:#0b0e14; --play-line:#ffc233;
  --name-font:"Anton","Arial Narrow","Helvetica Neue",Impact,sans-serif; --name-weight:400; --name-track:.01em; --name-case:uppercase;
  --link-weight:650; --link-size:12.5px; --link-track:.08em; --link-case:uppercase; --photo-r:0px;
}
html[data-look="pixel"]{
  --bg:#e8e6df; --ink:#1c1c1a; --dim:#55554e; --line:#1c1c1a; --focus:#0a53c2;
  --play-bg:#1c1c1a; --play-ink:#e8e6df; --play-line:#1c1c1a;
  --font:"JetBrains Mono",ui-monospace,Menlo,Consolas,monospace; --name-weight:800; --name-track:-.02em;
  --link-weight:500; --link-size:13.5px; --say-size:14px; --photo-r:0px;
}

html{background:var(--bg);color:var(--ink);-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;font:400 15px/1.45 var(--font);-webkit-font-smoothing:antialiased}
canvas,img{image-rendering:auto}

.front{box-sizing:border-box;min-height:100vh;min-height:100svh;display:flex;flex-direction:column;justify-content:center;background:var(--bg);color:var(--ink);
  padding:max(14px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
.f-sheet{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"id photo" "nav nav";gap:14px 14px;width:100%;max-width:520px;margin:0 auto}
.f-id{grid-area:id;min-width:0}
.f-name{margin:0;font:var(--name-style) var(--name-weight) clamp(30px,10.5vw,46px)/1.02 var(--name-font);letter-spacing:var(--name-track);text-transform:var(--name-case)}
.f-say{margin:10px 0 0;font-size:var(--say-size);line-height:1.42;color:var(--dim);max-width:34em}
.f-photo{grid-area:photo;display:block;align-self:start;border-radius:var(--photo-r)}
.f-photo img{display:block;width:96px;height:120px;object-fit:cover;object-position:50% 21%;border-radius:var(--photo-r);background:var(--line)}
.f-nav{grid-area:nav;min-width:0}
.f-links{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:14px;border-top:1px solid var(--line)}
.f-wide{grid-column:1 / -1}
.f-links a{box-sizing:border-box;display:flex;align-items:center;min-height:var(--row);padding:4px 0;border-bottom:1px solid var(--line);color:var(--ink);text-decoration:none;
  font-size:var(--link-size);font-weight:var(--link-weight);letter-spacing:var(--link-track);text-transform:var(--link-case);line-height:1.2}
.f-links a.f-play{justify-content:center;margin-top:8px;min-height:46px;padding:4px 14px;border:1px solid var(--play-line);border-radius:999px;background:var(--play-bg);color:var(--play-ink);font-weight:650;letter-spacing:.02em}
.f-links li:nth-last-child(2) a{margin-top:8px;min-height:46px;border-bottom-color:transparent}
a:focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:3px}
.f-links a.f-play:focus-visible{border-radius:999px}
@media (hover:hover){.f-links a:hover{color:var(--focus)}.f-links a.f-play:hover{color:var(--play-ink);border-color:var(--focus);background:var(--focus)}}

/* a tall phone: the photograph across, between the words and the links */
@media (min-height:700px) and (max-width:699px){
  .f-sheet{grid-template-columns:minmax(0,1fr);grid-template-areas:"id" "photo" "nav";gap:18px}
  .f-photo img{width:100%;height:auto;aspect-ratio:5 / 4;object-position:50% 16%}
  :root{--row:48px}
}
/* a small phone: everything a little closer, so the whole page is one screen */
@media (max-height:699px) and (max-width:559px){
  .front{padding-top:max(10px,env(safe-area-inset-top));padding-bottom:max(10px,env(safe-area-inset-bottom))}
  .f-sheet{gap:10px 12px}
  .f-name{font-size:clamp(26px,9vw,38px)}
  .f-say{margin-top:6px;font-size:13px;line-height:1.35}
  .f-links a.f-play,.f-links li:nth-last-child(2) a{margin-top:4px;min-height:44px}
}
/* a phone on its side */
@media (max-height:520px) and (min-width:560px){
  .f-sheet{max-width:860px;grid-template-columns:minmax(0,5fr) minmax(0,6fr);grid-template-areas:"id nav" "photo nav";gap:10px 28px;align-content:center}
  .f-name{font-size:clamp(28px,5vw,40px)}
  .f-say{margin-top:6px;font-size:13.5px}
  .f-sheet{grid-template-rows:auto 1fr}
  .f-photo{justify-self:start}
  .f-photo img{width:150px;height:120px;object-position:50% 16%}
  .f-links a.f-play,.f-links li:nth-last-child(2) a{margin-top:4px;min-height:44px}
}
/* a desk */
@media (min-width:900px) and (min-height:521px){
  .front{padding:40px 56px}
  .f-sheet{max-width:1040px;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"id photo" "nav photo";gap:34px 72px;align-items:start}
  .f-name{font-size:clamp(56px,6vw,84px)}
  .f-say{margin-top:18px;font-size:calc(var(--say-size) + 3px);max-width:30em}
  .f-photo{align-self:center}
  .f-photo img{width:min(400px,30vw,56vh);height:auto;aspect-ratio:4 / 5;object-position:50% 50%}
  .f-links a{font-size:calc(var(--link-size) + 1px)}
  :root{--row:50px}
}

/* ---- looks: what differs beyond the tokens ---- */
html[data-look="silk"] .f-name{font-size:clamp(40px,13vw,58px)}
html[data-look="silk"] .f-links,html[data-look="silk"] .f-links a{border-color:var(--line)}
html[data-look="silk"] .f-links a.f-play{border-color:var(--play-line)}

html[data-look="burn"] .f-id{text-align:center;padding-bottom:12px;border-bottom:3px double var(--line)}
html[data-look="burn"] .f-name{font-size:clamp(22px,7.2vw,30px);line-height:1.2}
html[data-look="burn"] .f-say{margin-left:auto;margin-right:auto;font-style:italic}
html[data-look="burn"] .f-links{border-top:0}
html[data-look="burn"] .f-links a{border-bottom:1px solid rgba(42,32,24,.28)}
html[data-look="burn"] .f-links a.f-play{border-radius:0;letter-spacing:.14em;text-transform:uppercase;font-size:13px;border-color:var(--play-line)}
html[data-look="burn"] .f-photo img{border:5px solid #fbf6ea;box-sizing:border-box}
@media (max-width:699px) and (max-height:699px), (max-height:520px){html[data-look="burn"] .f-id{text-align:left}html[data-look="burn"] .f-say{margin-left:0}}

html[data-look="fall"] .f-name{font-size:clamp(46px,16vw,72px);line-height:.98}
html[data-look="fall"] .f-say{color:var(--dim)}
html[data-look="fall"] .f-links{border-top:0;gap:8px;column-gap:8px}
html[data-look="fall"] .f-links a{min-height:44px;padding:4px 12px;border:1px solid var(--line);background:#121722}
html[data-look="fall"] .f-links a.f-play{margin-top:0;min-height:44px;border-radius:0;background:var(--play-bg);border-color:var(--play-line);letter-spacing:.12em}
html[data-look="fall"] .f-links li:nth-last-child(2) a{margin-top:0;min-height:44px;border-bottom-color:var(--line)}
@media (hover:hover){html[data-look="fall"] .f-links a:hover{border-color:var(--focus);color:var(--focus)}html[data-look="fall"] .f-links a.f-play:hover{background:#fff;border-color:#fff;color:#0b0e14}}

html[data-look="pixel"] .f-name{font-size:clamp(27px,9.4vw,40px)}
html[data-look="pixel"] .f-links{border-top:1px solid var(--line)}
html[data-look="pixel"] .f-links a{border-bottom:1px solid rgba(28,28,26,.3)}
html[data-look="pixel"] .f-links a.f-play{border-radius:0;border-color:var(--play-line);text-transform:uppercase;letter-spacing:.1em}

@media (min-height:700px) and (max-width:699px){
  html[data-look="fall"] .f-sheet{gap:14px}
  html[data-look="fall"] .f-name{font-size:clamp(46px,15vw,66px)}
  html[data-look="fall"] .f-links{gap:6px;column-gap:8px}
  html[data-look="fall"] .f-photo img{aspect-ratio:4 / 3}
}
@media (max-height:699px) and (max-width:559px){
  html[data-look="silk"] .f-name{font-size:clamp(34px,12vw,46px)}
  html[data-look="burn"] .f-name{font-size:clamp(17px,5.6vw,22px);letter-spacing:.1em}
  html[data-look="burn"] .f-say{font-size:14px}
  html[data-look="burn"] .f-id{padding-bottom:8px}
  html[data-look="fall"] .f-name{font-size:clamp(32px,10.6vw,42px)}
  html[data-look="fall"] .f-links{gap:4px;column-gap:6px}
  html[data-look="pixel"] .f-name{font-size:clamp(22px,7.4vw,30px)}
  html[data-look="pixel"] .f-say{font-size:12px}
}
@media (max-height:520px) and (min-width:560px){
  html[data-look] .f-name{font-size:clamp(26px,4.6vw,38px)}
  html[data-look="fall"] .f-links{gap:6px}
  html[data-look="burn"] .f-id{padding-bottom:8px}
}
@media (min-width:900px) and (min-height:521px){
  html[data-look="silk"] .f-name{font-size:clamp(72px,8vw,112px)}
  html[data-look="burn"] .f-sheet{max-width:940px}
  html[data-look="burn"] .f-id{text-align:left;padding-bottom:22px}
  html[data-look="burn"] .f-name{font-size:clamp(34px,3.4vw,46px)}
  html[data-look="burn"] .f-say{margin-left:0}
  html[data-look="burn"] .f-photo img{border-width:10px}
  html[data-look="fall"] .f-name{font-size:clamp(96px,10vw,150px)}
  html[data-look="fall"] .f-links{gap:10px}
  html[data-look="pixel"] .f-name{font-size:clamp(48px,4.6vw,64px)}
}

/* ---- the stage and the fall (classes set by front.js) ---- */
.f-stage{position:fixed;left:0;top:0;width:100%;height:100%;display:block;z-index:5;pointer-events:none;touch-action:pinch-zoom}
.f-stage[hidden]{display:none}
/* the page lives inside the canvas where the browser can draw it there: the canvas is the page, and takes presses */
.f-stage.f-live{pointer-events:auto}
.f-stage > .front{width:100%;height:100%;min-height:0}
/* the page is drawn on the stage by hand (Silk at rest): the real one stays on top, unseen, for its links */
html.f-ghost .front{opacity:0}
html.f-ghost .f-stage{z-index:0}
html.f-ghost .front{position:relative;z-index:1}
/* nearly anything falls into the game, so the page does not scroll or pull */
html.f-armed,html.f-armed body{height:100%;overflow:hidden;overscroll-behavior:none}
html.f-armed .front{touch-action:pinch-zoom}
/* falling: what the game's own page shows while it loads stands behind, the same picture in the same place */
html.f-fall{background:#1b1026}
html.f-fall,html.f-fall body{height:100%;overflow:hidden;overscroll-behavior:none}
html.f-fall body{background:#1b1026 var(--still,url(/unwritten-stars/px/art/still.png)) center / contain no-repeat;image-rendering:pixelated}
html.f-fall body > .front{display:none}
html.f-fall .f-stage{pointer-events:auto;touch-action:none}
html.f-gone .f-stage{display:none}

@media print{.f-stage{display:none}html.f-ghost .front{opacity:1}}
