/* =============================================================================
   The shared look. One file, every page except /legacy.

   WHY IT LIVES IN web/public
   Everything is on one hostname now, so this is reachable from every app as
   /theme.css - the landing page, the admin, the sign-in pages. Each of those
   is a separate container in a different language, and without this they were
   six copies of the same palette drifting apart one tweak at a time.

   Change a colour here and it changes everywhere. No rebuild: Caddy serves
   this file straight from disk, so a save is live on the next page load.

   /legacy DELIBERATELY DOES NOT USE THIS. The photo gallery has its own
   warmer palette because it is for family looking at old pictures, not for
   the person who administers a server. Different audience, different room.
   ========================================================================== */

:root{
  --bg:#050a12;
  --ink:#e8f0f8;
  --muted:#7e93a8;
  --line:rgba(120,170,225,.18);
  --panel:rgba(10,20,34,.62);
  --accent:#5aa2e8;
  --ok:#5ae8a2;
  --bad:#e8695a;
  --warn:#e8a35a;
  --radius:14px;
  --mono:ui-monospace,"Cascadia Code",Consolas,monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:var(--bg);color:var(--ink);
  font:16px/1.6 ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}

/* --- layout ------------------------------------------------------------- */
.wrap{position:relative;z-index:2;width:min(940px,100%);margin:0 auto;
  padding:clamp(1.4rem,4vw,2.4rem) 1.25rem 3rem}
.wrap.narrow{width:min(660px,100%)}
.centre{min-height:100%;display:grid;place-items:center;padding:1.25rem}

/* --- the live background, shared with the landing page ------------------ */
#bg{position:fixed;inset:0;width:100%;height:100%;z-index:0;display:block}
.vignette{position:fixed;inset:0;z-index:1;pointer-events:none;
  background:radial-gradient(ellipse 120% 90% at 50% 42%,transparent 35%,rgba(5,10,18,.82) 100%)}

/* --- type --------------------------------------------------------------- */
h1{margin:0 0 .3rem;font-size:1.3rem;font-weight:700;letter-spacing:-.01em}
h2{margin:0;font-size:1.05rem;font-weight:650}
.sub{margin:0 0 1.4rem;color:var(--muted);font-size:.87rem}
.kicker{margin:0;font-size:.7rem;letter-spacing:.1em;text-transform:uppercase;
  color:var(--accent);opacity:.9}
code,.mono{font-family:var(--mono);font-size:.78rem;color:var(--muted)}

/* --- panels ------------------------------------------------------------- */
.panel{
  background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);
  padding:1.25rem;
  backdrop-filter:blur(11px) saturate(1.25);-webkit-backdrop-filter:blur(11px) saturate(1.25);
}
.panel + .panel{margin-top:.9rem}

/* --- cards, same behaviour as the landing page -------------------------- */
.grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fill,minmax(240px,1fr))}
a.card{
  position:relative;display:flex;flex-direction:column;gap:.4rem;
  padding:1.3rem 1.25rem 1.4rem;border-radius:16px;text-decoration:none;color:inherit;
  background:var(--panel);border:1px solid var(--line);
  backdrop-filter:blur(11px) saturate(1.25);-webkit-backdrop-filter:blur(11px) saturate(1.25);
  overflow:hidden;isolation:isolate;
  transition:transform .28s cubic-bezier(.2,.8,.3,1),border-color .28s,background .28s;
}
a.card::before{content:"";position:absolute;inset:0;z-index:-1;opacity:0;transition:opacity .3s;
  background:radial-gradient(120% 90% at 12% 0%,var(--accent),transparent 62%)}
a.card::after{content:"";position:absolute;left:1.2rem;right:1.2rem;top:0;height:1px;
  background:linear-gradient(90deg,transparent,var(--accent),transparent);
  opacity:.45;transition:opacity .3s}
a.card:hover,a.card:focus-visible{transform:translateY(-4px);
  border-color:color-mix(in srgb,var(--accent) 55%,transparent)}
a.card:hover::before,a.card:focus-visible::before{opacity:.14}
a.card:hover::after,a.card:focus-visible::after{opacity:1}
a.card:focus-visible{outline:2px solid var(--accent);outline-offset:3px}

.ico{width:40px;height:40px;border-radius:11px;display:grid;place-items:center;
  background:color-mix(in srgb,var(--accent) 15%,transparent);
  border:1px solid color-mix(in srgb,var(--accent) 32%,transparent);margin-bottom:.3rem}
.ico svg{width:20px;height:20px;stroke:var(--accent);fill:none;stroke-width:1.7;
  stroke-linecap:round;stroke-linejoin:round}
.ico.lg{width:46px;height:46px}
.ico.lg svg{width:23px;height:23px}

/* --- forms -------------------------------------------------------------- */
label{display:block;font-size:.78rem;color:var(--muted);margin-bottom:.4rem}
input[type=text],input[type=email],input[type=password],input[type=file],select,textarea{
  width:100%;padding:.72rem .8rem;border-radius:10px;
  border:1px solid var(--line);background:rgba(5,12,22,.75);color:var(--ink);
  /* 16px, not smaller: anything under 16px makes iOS Safari zoom the whole
     page when the field is focused, which feels broken on a phone. */
  font-size:16px;font-family:inherit;
}
input:focus,select:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:1px}

/* --- validation, in CSS alone ------------------------------------------- */
/* Jason sent this as a reel using :placeholder-shown to mean "the person has
   typed something". THAT TRICK ONLY WORKS IF EVERY INPUT HAS A placeholder
   ATTRIBUTE, and almost none here do -- the password fields on this very form
   have none. Without one, :placeholder-shown never matches, :not(:placeholder-
   shown) is therefore always true, and every empty required field would turn
   red the instant the page loaded, before anybody typed a character.

   :user-invalid is the standard built for exactly this and it needs no
   placeholder: the browser applies it only after the person has actually
   interacted with the field and left it wrong. Widely available since 2023.
   It is also simply less to write -- one pseudo-class instead of a
   :not(:has(...:not(...))) chain.

   NO CLASS TO REMEMBER. This matches `form` and `input` directly, so every
   form in every app gets it without being edited. A rule that needs a class
   added by hand is a rule that is on half the forms a year from now. */
input:user-invalid,select:user-invalid,textarea:user-invalid{
  border-color:var(--bad);
}
/* GREEN ONLY WHERE THERE WAS A RULE TO PASS. :user-valid matches any field
   the person has touched, including one with no constraints at all -- so
   without this guard a plain optional text box goes green for being typed in,
   which claims a check happened that never did. A tick that means nothing is
   worse than no tick, because it teaches people to ignore the real ones. */
input:is(:required,[pattern],[minlength],[type=email],[type=url],[type=number]):user-valid,
select:required:user-valid,
textarea:is(:required,[pattern],[minlength]):user-valid{
  border-color:var(--ok);
}

/* The panel edge answers the whole form: red while anything is wrong, green
   only once something has been filled in AND nothing is wrong. */
form:has(:user-invalid){border-color:var(--bad)}
form:has(:user-valid):not(:has(:user-invalid)){border-color:var(--ok)}

/* THE SUBMIT BUTTON IS DIMMED, NOT DISABLED, and that is a deliberate
   departure from the reel. It used `pointer-events:none`, which stops the
   click and nothing else: the browser ALREADY refuses to submit an invalid
   form, and when it does it points at the offending field and says what is
   wrong. Swallowing the click throws that message away and leaves somebody
   pressing a dead button with no idea why. Worse for a keyboard user, who can
   still tab to it and press Enter -- so it is not even consistent.

   Dimming says "not ready yet"; the browser still explains why. */
form:has(:user-invalid) button[type=submit],
form:has(:user-invalid) .btn[type=submit]{
  opacity:.55;
}
input[type=file]{padding:.5rem;font-size:.84rem;color:var(--muted)}
input[type=file]::file-selector-button{margin-right:.7rem;padding:.45rem .75rem;border-radius:8px;
  border:1px solid var(--line);background:rgba(10,20,34,.9);color:var(--ink);
  cursor:pointer;font-size:.82rem;font-family:inherit}

button,.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.4rem;
  padding:.7rem 1.2rem;border-radius:10px;border:0;cursor:pointer;
  background:var(--accent);color:#04101d;font-weight:650;font-size:.95rem;
  font-family:inherit;text-decoration:none;transition:filter .2s ease;
}
button:hover,.btn:hover{filter:brightness(1.09)}
button.wide{width:100%}
button.ghost{background:none;border:1px solid var(--line);color:var(--muted)}
button.ghost:hover{color:var(--ink);border-color:var(--accent)}
button.link{background:none;border:0;color:var(--muted);text-decoration:underline;
  padding:0;font-size:.8rem;font-weight:400}
button.link:hover{color:var(--ink)}

/* --- messages ----------------------------------------------------------- */
.note{margin:0 0 1.1rem;padding:.7rem .85rem;border-radius:10px;font-size:.85rem;
  white-space:pre-line}
.note.ok{background:color-mix(in srgb,var(--ok) 10%,transparent);
  border:1px solid color-mix(in srgb,var(--ok) 35%,transparent);color:#d2ffe9}
.note.bad{background:color-mix(in srgb,var(--bad) 12%,transparent);
  border:1px solid color-mix(in srgb,var(--bad) 40%,transparent);color:#ffd9d3}
.note.info{background:color-mix(in srgb,var(--accent) 8%,transparent);
  border:1px solid var(--line);color:var(--muted)}

/* --- bits --------------------------------------------------------------- */
.row{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap}
.between{display:flex;justify-content:space-between;align-items:baseline;gap:.8rem;flex-wrap:wrap}
.back{display:inline-block;margin-bottom:1rem;color:var(--muted);
  font-size:.82rem;text-decoration:none}
.back:hover{color:var(--ink)}
a{color:var(--accent)}
.dot{width:6px;height:6px;border-radius:50%;background:var(--muted);opacity:.45;flex:none}
.dot.on{background:var(--ok);opacity:1}
footer{margin-top:2rem;text-align:center;color:var(--muted);font-size:.76rem;line-height:1.7}

@media (prefers-reduced-motion:reduce){
  a.card,button,.btn,.card .go svg{transition:none}
  a.card:hover{transform:none}
}
