/* The LukasOS interface, shared by every page under /os/ that wears the hub's look.

   cyberpunk.net's grammar over a night photo of Riddarholmen (Lucas Santos,
   Unsplash). Every colour is taken from that photo: the navy of the sky for
   every surface, the copper of the lit facades for every line and every lit
   control, the lamp-white for type, the brick of Gamla Stan for the one thing
   that is unfinished.

   Here: tokens, the photo, the cut (outlined controls), buttons, the top bar,
   panels, fields, tags, dialogs, and the page transition. A page keeps its own
   layout in its own <style>, after this file. DESIGN.md is the spec.

   Tektur, condensed, for names. Chakra Petch for everything else. Both load
   from Google Fonts, with the same <link> on every page:
   family=Chakra+Petch:ital,wght@0,500;0,600;1,500&family=Tektur:wdth,wght@75..100,500..800 */

:root{
  --sky:#08121A;
  --panel:#0A151E;          /* opaque: a translucent fill lets the line colour under it bleed through */
  --well:#050C12;           /* inset surfaces: fields, the dark of a map */
  --copper:#E9A86A;         /* 9.0:1 on the panel */
  --line:#5A4836;           /* a resting outline: copper at a third */
  --line-hi:#8C6A4B;        /* 3.8:1, for a field's edge and anything that must be found */
  --ink:#F1E6D6;            /* 15:1 */
  --ink-dim:#B8AD9E;        /* 8.4:1 */
  --brick:#D9654A;          /* 5.2:1, only for what is unfinished */
  --steel:#8296A6;          /* the sky at map scale: sea labels, the unlit land */
  --on-copper:#3A2A1C;      /* secondary type on a lit control, 6.7:1 */
  --name:"Tektur",ui-sans-serif,sans-serif;
  --ui:"Chakra Petch",ui-sans-serif,sans-serif;
  --pad:clamp(14px,1.4vw,24px);
  --c:14px;                 /* the corner cut */
}

*{box-sizing:border-box}
html{color-scheme:dark;scrollbar-color:var(--line-hi) var(--sky);-webkit-text-size-adjust:100%}
body{margin:0;background:var(--sky);color:var(--ink);font:500 16px/1.4 var(--ui);
  -webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
img{display:block;max-width:100%}
button{font:inherit;color:inherit}
::selection{background:var(--copper);color:var(--sky)}
:focus-visible{outline:2px solid var(--copper);outline-offset:2px}
.wrap{max-width:2100px;margin:0 auto;padding:0 var(--pad);width:100%}
[hidden]{display:none!important}
.vh{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
  clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* The photo, anchored to the waterline so the city always sits on the floor
   of the window and the sky takes whatever height is left over. A fixed layer
   rather than background-attachment, which iOS ignores. A page that carries
   content sets --veil to quieten it. */
.city{position:fixed;inset:0;z-index:-1;
  background:
    linear-gradient(180deg,rgba(8,18,26,.5) 0%,rgba(8,18,26,0) 30%,rgba(8,18,26,0) 82%,rgba(8,18,26,.72) 100%),
    url("/assets/os-stockholm-2560.jpg") 50% 100%/cover no-repeat,
    var(--sky)}
.city::after{content:"";position:absolute;inset:0;background:rgba(8,18,26,var(--veil,0))}
@media (max-width:1280px){
  .city{background:
    linear-gradient(180deg,rgba(8,18,26,.5) 0%,rgba(8,18,26,0) 30%,rgba(8,18,26,0) 82%,rgba(8,18,26,.72) 100%),
    url("/assets/os-stockholm-1280.jpg") 50% 100%/cover no-repeat,
    var(--sky)}
}

/* ---------- the cut ----------
   Every outlined thing is three layers: the line colour cut to shape, a fill
   inset 1px and cut to the same shape, and a tick notched into the left edge,
   painted on the fill so it always meets the line. Lighting a control swaps
   the fill. Content sits above all three, so a scrolling region goes inside
   a cut element, never on it. */
.cut{position:relative;isolation:isolate;--ln:var(--line);--fill:var(--panel);--tick:9px;--tick-y:50%}
.cut::before,.cut::after{content:"";position:absolute;z-index:-1;pointer-events:none}
.cut::before{inset:0;background:var(--ln);transition:background-color .16s ease;
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--c)),calc(100% - var(--c)) 100%,0 100%)}
.cut::after{inset:1px;background-color:var(--fill);
  background-image:linear-gradient(var(--ln),var(--ln));
  background-repeat:no-repeat;background-size:var(--tick) 2px;background-position:0 var(--tick-y);
  transition:background-color .16s ease;
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--c) + .6px),calc(100% - var(--c) + .6px) 100%,0 100%)}

/* A cut surface that answers a hand: dim copper outline at rest, solid copper
   when lit. Text inside reads --t1 and --t2 and icons read --ic, so a lit
   surface inverts without a rule per child. */
.hit{cursor:pointer;--t1:var(--ink);--t2:var(--ink-dim);--ic:var(--copper);transition:color .16s ease}
.hit:hover,.hit:focus-visible,.hit.lit{--ln:var(--copper);--fill:var(--copper);
  --t1:var(--sky);--t2:var(--on-copper);--ic:var(--sky);outline:none}
/* A selected surface keeps its fill and takes the copper line. */
.hit.on{--ln:var(--copper)}
.hit.on:hover,.hit.on:focus-visible{--fill:var(--copper)}

.ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.5;
  stroke-linecap:square;stroke-linejoin:miter}

/* ---------- buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;height:38px;
  padding:0 18px 0 22px;cursor:pointer;border:0;background:none;white-space:nowrap;
  font:600 14px/1 var(--ui);letter-spacing:.14em;text-transform:uppercase;color:var(--copper);
  --ln:var(--copper);--fill:var(--sky);--c:10px;--tick:7px;transition:color .16s ease}
.btn .ic{width:16px;height:16px}
.btn.fill,.btn.on{--fill:var(--copper);color:var(--sky)}
.btn:hover,.btn:focus-visible{--fill:var(--copper);color:var(--sky);outline:none}
.btn.fill:hover,.btn.fill:focus-visible,.btn.on:hover,.btn.on:focus-visible{--ln:var(--ink);--fill:var(--ink)}
.btn:disabled{opacity:.45;cursor:default;pointer-events:none}
.btn.sm{height:32px;padding:0 14px 0 18px;font-size:12.5px;letter-spacing:.12em;--c:8px;--tick:5px}
.btn .n{opacity:.75;font-variant-numeric:tabular-nums}

/* ---------- top ---------- */
.top{display:flex;align-items:center;justify-content:space-between;gap:18px;flex-wrap:wrap;
  padding-top:clamp(18px,3.2vh,40px);padding-bottom:clamp(16px,3vh,36px)}

.mark{display:inline-flex;align-items:center;gap:.16em;
  font:800 clamp(38px,min(3.3vw,6vh),64px)/.9 var(--name);font-stretch:78%;letter-spacing:.01em;
  text-transform:uppercase;color:var(--ink)}
/* OS sits in a filled tag cut on two corners. Every few seconds it glitches
   for three frames, then holds still. */
.mark .os{position:relative;display:inline-block;padding:.07em .13em .05em;background:var(--copper);color:var(--sky);
  clip-path:polygon(.15em 0,100% 0,100% calc(100% - .15em),calc(100% - .15em) 100%,0 100%,0 .15em)}
.mark .os::before,.mark .os::after{content:"OS";position:absolute;inset:0;padding:inherit;
  color:var(--sky);opacity:0;pointer-events:none}
.mark .os::before{background:var(--copper);animation:slice-a 8.3s steps(1,end) 2.4s infinite}
.mark .os::after{background:var(--brick);animation:slice-b 8.3s steps(1,end) 2.4s infinite}
@keyframes slice-a{
  0%,96.4%{opacity:0;transform:none;clip-path:inset(0)}
  96.5%{opacity:1;transform:translateX(-.06em);clip-path:inset(18% 0 52% 0)}
  97.3%{opacity:1;transform:translateX(.05em);clip-path:inset(60% 0 12% 0)}
  98.1%,100%{opacity:0;transform:none;clip-path:inset(0)}}
@keyframes slice-b{
  0%,96.8%{opacity:0;transform:none;clip-path:inset(0)}
  96.9%{opacity:1;transform:translateX(.07em);clip-path:inset(42% 0 40% 0)}
  97.7%,100%{opacity:0;transform:none;clip-path:inset(0)}}

.ctrls{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
/* The language switch wears the same cut as the buttons beside it. */
.ctrls .lang{--c:10px;--tick:0px;--fill:var(--sky);border:0!important;border-radius:0!important;margin-left:4px;
  color:var(--copper);--lang-on-bg:var(--copper);--lang-on-fg:var(--sky);
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--c)),calc(100% - var(--c)) 100%,0 100%)}
.ctrls .lang button{margin:1px 0}
.ctrls .lang button:first-child{margin-left:1px}
.ctrls .lang button:last-child{margin-right:1px}
.ctrls .i18n-switch button{font-family:var(--ui);font-weight:600;font-size:13px;letter-spacing:.12em;
  min-height:36px;padding:0 11px}
.ctrls .i18n-switch button+button{border-left-color:var(--line)}

/* A page below the hub: a smaller mark, so the page's own title leads. */
.sub .top{padding-top:clamp(14px,2.2vh,26px);padding-bottom:clamp(12px,2vh,22px)}
.sub .mark{font-size:clamp(28px,min(2.3vw,4.4vh),42px)}
.sub .page{min-height:100dvh;display:flex;flex-direction:column}
.sub .page>main{flex:1 0 auto;min-width:0}
.sub{--veil:.7}

/* ---------- type ---------- */
.h1{margin:0;font:800 clamp(36px,min(3.4vw,6vh),64px)/.92 var(--name);font-stretch:78%;letter-spacing:.01em;
  text-transform:uppercase;color:var(--ink)}
.h2{margin:0;font:700 clamp(19px,min(1.45vw,2.8vh),28px)/1 var(--name);font-stretch:78%;letter-spacing:.06em;
  text-transform:uppercase;color:var(--ink-dim)}
.lbl{font:600 13px/1.2 var(--ui);letter-spacing:.16em;text-transform:uppercase;color:var(--ink-dim)}
.tag{display:inline-block;flex:none;font:600 12px/1 var(--ui);letter-spacing:.14em;text-transform:uppercase;
  color:var(--ink-dim);border:1px solid var(--line-hi);padding:4px 6px 3px}

/* ---------- panels ---------- */
.panel{padding:clamp(16px,1.4vw,26px) clamp(16px,1.4vw,26px) clamp(16px,1.4vw,26px) clamp(22px,1.7vw,32px)}

/* ---------- fields ---------- */
.fld{display:block;width:100%;min-height:44px;font:500 17px/1.3 var(--ui);color:var(--ink);
  background:var(--well);border:1px solid var(--line-hi);border-radius:0;padding:10px 12px;
  transition:border-color .16s ease}
.fld::placeholder{color:#9A8F80;opacity:1}
.fld:hover{border-color:var(--ink-dim)}
.fld:focus-visible{outline:none;border-color:var(--copper);box-shadow:0 0 0 1px var(--copper)}
textarea.fld{resize:vertical;line-height:1.4}
select.fld{appearance:none;-webkit-appearance:none;cursor:pointer;padding-right:38px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E9A86A' stroke-width='1.5' stroke-linecap='square'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 11px center;background-size:16px}
.fld:disabled{opacity:.5;cursor:default}

/* ---------- dialogs ---------- */
.dlg{padding:0;border:0;background:none;color:var(--ink);overflow:visible}
.dlg::backdrop{background:rgba(5,10,15,.8)}
.xbtn{width:44px;height:44px;display:grid;place-items:center;background:none;border:0;cursor:pointer;
  color:var(--ink-dim);transition:color .16s ease}
.xbtn .ic{width:18px;height:18px}
.xbtn:hover,.xbtn:focus-visible{color:var(--copper);outline:none}

/* ---------- foot ---------- */
.bottom{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:10px 20px;
  padding-top:16px;padding-bottom:clamp(14px,2.4vh,26px)}
.sig{font:600 13px/1 var(--ui);letter-spacing:.16em;text-transform:uppercase;color:var(--ink-dim)}

@media (max-width:640px){
  .top{flex-direction:column;align-items:flex-start;gap:16px}
}
/* ---------- moving between pages ----------
   Every page under /os/ opts in to a cross-document view transition. Three
   things are named. The photo stays on screen the whole time and only changes
   how dark it is; the page (top bar, content, foot) leaves quickly and the next
   one arrives a beat later, so the two are never on screen together; the
   wordmark shrinks or grows into place between the hub and the pages below it.
   A browser without view transitions, or a visitor who asks for reduced
   motion, gets an ordinary page change. */
@media (prefers-reduced-motion:no-preference){
  @view-transition{navigation:auto}
}
.city{view-transition-name:city}
.page{view-transition-name:page}
.mark{view-transition-name:mark}
::view-transition-group(*){animation-duration:.24s;animation-timing-function:cubic-bezier(.22,1,.36,1)}
::view-transition-old(page),::view-transition-new(page){mix-blend-mode:normal}
::view-transition-old(page){animation:vt-out .09s cubic-bezier(.3,.7,.5,1) both}
::view-transition-new(page){animation:vt-in .17s cubic-bezier(.22,1,.36,1) .04s both}
@keyframes vt-out{to{opacity:0}}
@keyframes vt-in{from{opacity:0}}
/* While a change is being drawn from the top of a page, the page is cut to the
   window, so the browser snapshots what is on screen and not the whole length of
   a long page. os-nav.js sets the class. */
html.vt-snap .page{height:100dvh;overflow:clip}
html.vt-bar{overflow-y:scroll}
/* From further down a page, nothing is named and the whole window dissolves. */
html.vt-plain .city,html.vt-plain .page,html.vt-plain .mark{view-transition-name:none}
html.vt-plain::view-transition-group(root){animation-duration:.18s}

@media (prefers-reduced-motion:reduce){
  .mark .os::before,.mark .os::after{animation:none}
  .cut::before,.cut::after,.btn,.hit,.fld,.xbtn{transition:none}
}
