/* The login screen, and only it (templates/login.html.jinja2). Colours come from tokens.css.
   The page never goes dark -- it carries data-theme="light", so the dark blocks in
   tokens.css cannot reach it (owner brief 13.11.2026: "the login screen is always light").

   The art is four layers the owner draws on one 1585x992 canvas, so they stack with no
   positioning of their own (owner, 16.11.2026, data/local/tasks/phoenix): the valley with the
   lorry on .login-stage, then the granite slab and the phoenix as two background layers of
   .login-rock, then the fire glow on .login-rock::before, which is the only one that moves.

   Layout, desktop (>= 768px): the valley fills the viewport, the slab sits on top of it on the
   right, and the form sits ON the slab's flat face -- on the stone itself, not in a card over
   it (owner, 16.11.2026: the comp shows granite behind the labels, and the white panel the
   first build used hid the material the picture exists for). There is nothing behind the form
   at all -- not a card, not a wash: the owner asked for the wash to come off too, so the
   photograph itself is the background. The lockup likewise loses its white plaque and moves
   into the middle of the valley, the empty half the slab does not reach.

   What that costs, measured on the stacked art over the column the text occupies (x 60.2 to
   84.5%, y 37.3 to 82.7% of the canvas): --on-scrim is 6.9:1 against the median pixel, and
   7.8% of that column is still under 4.5:1. Those are the pale flecks in the granite itself,
   not an edge that could be avoided: the column was pulled in by a tenth on 16.11.2026 and
   the share did not move. The white fields are unaffected, since they paint their own
   background, and so is the submit button on --accent. This is a deviation from the 4.5:1 the
   rest of the product holds to, it is the owner's call of 16.11.2026 to have no wash, and
   tests/test_token_contrast.py cannot see it either way: it knows about token pairs, not
   about text over a photograph.

   The panel scales with the rock, not with the viewport: .login-rock is an inline-size
   container and every size inside the panel is clamp(min, Ncqw, max). That is what keeps the
   form on the face at every width -- with rem sizes the panel kept its bulk while the stone
   shrank, and below ~1000px it slid off the stone onto the valley.

   Layout, phone (< 768px): no landscape at all. Both pictures are background images inside a
   min-width media query, so a phone never downloads the ~300 KB it would not show -- that is
   also why the art is CSS and not <img srcset>: an <img> is fetched whether or not a rule
   hides it. The responsive sources are image-set(), srcset's equivalent for a background.
   The phone keeps the plain white card: there is no stone under it to sit on.

   The rgb(... / %) values are scrims over a photograph, not theme colours -- the same
   exception tokens.css already documents for --on-scrim. */

* { box-sizing:border-box; }

body { margin:0; background:var(--bg); color:var(--ink);
       font-family:var(--font-sans); font-size:var(--text-md); line-height:var(--leading-body); }

.login-stage { position:relative; min-height:100vh; display:flex; flex-direction:column; }

/* --- the brand lockup ------------------------------------------------------------------- */

.login-lockup { display:flex; align-items:center; gap:0.85rem; padding:1.25rem 1.25rem 0; }
.login-lockup .brand-logo { flex:none; width:auto; height:54px; }
.login-words { display:flex; flex-direction:column; min-width:0; }
.login-name { font-size:1.6rem; font-weight:var(--weight-black); line-height:var(--leading-tight);
              letter-spacing:0.01em; }
.login-tagline { font-size:var(--text-sm); font-weight:var(--weight-semibold);
                 color:var(--muted); line-height:var(--leading-tight); }

/* --- the form panel --------------------------------------------------------------------- */

.login-art { flex:1; display:flex; align-items:center; justify-content:center;
             padding:1.25rem; min-width:0; }
.login-panel { width:100%; max-width:26rem; background:var(--card); border:1px solid var(--line);
               border-radius:var(--radius-xl); padding:1.75rem; }
/* The heading is not drawn anywhere any more (owner, 16.11.2026: "take the word off"). It
   stays in the markup, hidden the usual way, so the page keeps a heading for a screen reader
   and for the document outline; the submit button says the same word in the same language. */
.login-panel h1 { position:absolute; width:1px; height:1px; margin:-1px; padding:0; border:0;
                  overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.login-panel form { margin:0; }
.login-panel .field + .field { margin-top:var(--space-16); }
.login-panel label { display:block; font-weight:var(--weight-semibold); margin:0 0 var(--space-4); }
.login-panel input { width:100%; min-width:0; background:var(--card); color:var(--ink);
                     border:1px solid var(--control-border); border-radius:var(--radius-sm);
                     padding:0.6rem 0.75rem; font:inherit; }
.login-panel input:focus { outline:none; border-color:var(--accent);
                           box-shadow:0 0 0 3px var(--accent-soft); }
.login-panel input[aria-invalid="true"] { border-color:var(--status-error-fg); }
.field-hint { margin:var(--space-4) 0 0; color:var(--muted); font-size:var(--text-xs);
              line-height:var(--leading-tight); }
.field-error { margin:var(--space-4) 0 0; color:var(--status-error-fg); font-size:var(--text-sm);
               font-weight:var(--weight-semibold); }

.login-submit { width:100%; margin-top:var(--space-24); padding:0.7rem 1rem; border:0;
                border-radius:var(--radius-md); background:var(--accent); color:var(--on-accent);
                font:inherit; font-weight:var(--weight-bold); font-size:var(--text-lg);
                cursor:pointer; }
.login-submit:hover { background:var(--accent-hover); }

.login-notice { border-radius:var(--radius-md); padding:0.7rem 0.9rem; margin:0 0 1rem;
                background:var(--chip-ok-bg); color:var(--chip-ok-fg); }
.login-notice p { margin:0; }

.login-links { display:flex; flex-wrap:wrap; justify-content:space-between; gap:0.5rem;
               margin-top:var(--space-16); font-size:var(--text-sm); }
.login-foot { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
              gap:0.5rem; margin-top:var(--space-16); padding-top:var(--space-16);
              border-top:1px solid var(--line); font-size:var(--text-sm); }
.login-panel a { color:var(--accent); font-weight:var(--weight-semibold); }

.login-lang { display:flex; gap:0.3rem; flex-wrap:wrap; margin:0; }
.login-lang button { background:none; border:1px solid var(--line); border-radius:var(--radius-sm);
                     padding:0.2rem 0.5rem; font:inherit; font-size:var(--text-xs);
                     font-weight:var(--weight-bold); color:var(--muted); cursor:pointer; }
.login-lang button:hover { border-color:var(--accent); color:var(--accent); }
.login-lang button.current { background:var(--accent-soft); border-color:var(--accent);
                             color:var(--accent); }

/* --- 768px and up: the valley, and the lockup on the sky -------------------------------- */

@media (min-width: 768px) {
  .login-stage { background-image:image-set(url("../img/login/valley-1024.webp") 1x,
                                            url("../img/login/valley-1585.webp") 1.5x);
                 background-size:cover; background-position:center; background-repeat:no-repeat; }
  /* the lockup stands on the sky, with no plaque: the sky is light everywhere the lockup can
     reach, so --ink carries it, and the tagline leaves --muted behind for the same reason.
     It stays in the flow here -- only over the rock (next query) is there room to lift it out
     of the way of the card, and under 1100px it would sit on top of the card instead. */
  .login-lockup { padding:2.25rem 2.75rem; gap:1.1rem; }
  .login-lockup .brand-logo { height:clamp(70px, 7.8vw, 125px); }
  .login-name { font-size:clamp(2.6rem, 4.4vw, 4.4rem); letter-spacing:0.005em; }
  .login-tagline { color:var(--ink); font-size:clamp(1.17rem, 1.5vw, 1.6rem); }
  /* between 768 and 1100 there is no rock -- see the next query -- so the card keeps its own
     white scrim over the valley, the way the first build drew it on every width */
  .login-panel { background:rgb(255 255 255 / 86%); border-color:rgb(255 255 255 / 70%);
                 backdrop-filter:blur(3px); }
}

/* --- 1100px and up: the rock, and the form on its face ---------------------------------- */

/* Why 1100 and not 768: the panel is sized in cqw, so it keeps the same share of the rock at
   every width -- but the rock itself is 992/1585 of the viewport width, and below ~1100px its
   flat face is shorter than the form. Measured on the rock artwork, the face runs from
   0.40 to 0.88 of the art's height; at 820px wide that band is 246px and the form is 400px, so
   it would hang off the stone onto the valley. Under 1100px the valley stays and the form goes
   back into the white card above. */
@media (min-width: 1100px) {
  /* the lockup leaves the corner and stands in the sky of the valley half, above the ridge
     and above the sun, a third larger than the rest of the page would make it (owner,
     16.11.2026). The height matters as much as the place: lower down the picture puts the
     lorry and the dark forest behind the words, and over that box 40% of --ink was under
     4.5:1. Up here the whole box clears 9:1. */
  .login-lockup { position:absolute; left:32%; top:18%; translate:-50% -50%;
                  width:max-content; max-width:52%; padding:0; gap:1.45rem; }
  .login-art { position:relative; align-items:stretch; padding:0; }
  /* the slab and the bird: the artwork's own 1585x992, so the form's percentages land on the
     flat face. The phoenix is the first layer because the first layer paints on top, and it
     perches on the slab's top right corner. container-type makes the box the yardstick for
     every size inside the panel. */
  .login-rock { position:relative; width:100%; max-width:1585px; margin:auto;
                aspect-ratio:1585 / 992; container-type:inline-size;
                background-image:image-set(url("../img/login/phoenix-1024.webp") 1x,
                                           url("../img/login/phoenix-1585.webp") 1.5x),
                                 image-set(url("../img/login/granite-1024.webp") 1x,
                                           url("../img/login/granite-1585.webp") 1.5x);
                background-size:contain; background-position:center bottom;
                background-repeat:no-repeat;
                /* No scaling any more. The four layers are drawn to one canvas and the owner's
                   reference is that canvas stacked 1:1, slab on the right, road clear on the
                   left; the 0.75 this rule used to carry was a correction to art that put the
                   stone across the road, and the new art does not. */ }
  /* the phoenix's shimmer: the same canvas as the rock, so it lands on the bird to the pixel.
     It is a pseudo-element and not a second background layer because only its own opacity is
     animated. It sits under .login-panel, which comes later in the positioned order. */
  .login-rock::before { content:""; position:absolute; inset:0; pointer-events:none;
                        background-image:image-set(
                            url("../img/login/phoenix-shimmer-1024.webp") 1x,
                            url("../img/login/phoenix-shimmer-1585.webp") 1.5x);
                        background-size:contain; background-position:center bottom;
                        background-repeat:no-repeat;
                        animation:phoenix-shimmer 4.5s ease-in-out infinite alternate; }
  @keyframes phoenix-shimmer { from { opacity:0.3 } to { opacity:0.95 } }
  /* a flicker is decoration; anyone who asked the system for less motion gets it still */
  @media (prefers-reduced-motion: reduce) {
    .login-rock::before { animation:none; opacity:0.6; }
  }
  /* Nothing behind the form at all (owner, 16.11.2026: "take the wash off entirely"): the
     granite is the background. The slab the owner drew on 16.11.2026 is dark -- its median
     luminance under the form is 0.10 -- so the text over it is --on-scrim, the one token
     tokens.css keeps for ink on a photograph, and not --ink. Measured over the column the
     text occupies: --ink is 2.25:1 against the median pixel with 98% of the column under
     4.5:1, which is unreadable; --on-scrim is 6.9:1 with 7.8% under. The fields keep --ink,
     since they paint their own white background, and so does the submit button on --accent. */
  .login-panel { position:absolute; left:73%; top:60%; translate:-50% -50%;
                 width:29%; min-width:16rem; max-width:30rem;
                 padding:clamp(0.9rem, 1.7cqw, 1.9rem);
                 background:none; border:0; border-radius:0; backdrop-filter:none;
                 box-shadow:none; color:var(--on-scrim);
                 /* a tenth smaller than the face would otherwise make it (owner, 16.11.2026).
                    scale and not smaller cqw numbers, so the form keeps its proportions
                    exactly and stays centred on the same point of the stone: translate runs
                    before transform, so the -50% -50% above still lands the middle at
                    73% / 60%. */
                 transform:scale(0.9); }
  .login-panel label { font-size:clamp(0.9rem, 1.15cqw, 1.1rem);
                       margin:0 0 clamp(0.25rem, 0.5cqw, 0.45rem); }
  .login-panel .field + .field { margin-top:clamp(0.6rem, 1.25cqw, 1.15rem); }
  .login-panel input { font-size:clamp(0.9rem, 1.05cqw, 1.05rem); padding:0.6em 0.8em;
                       background:rgb(255 255 255 / 92%); border-color:rgb(120 114 110 / 55%);
                       border-radius:clamp(6px, 0.7cqw, 12px); }
  /* the deleted-account notice is the one thing that can make the form taller than the face,
     so on the stone it is compact */
  .login-notice { font-size:clamp(0.8rem, 1cqw, 1rem); padding:0.5em 0.7em;
                  margin:0 0 clamp(0.5rem, 1cqw, 0.9rem); }
  /* everything the panel writes straight onto the stone goes light, for the reason above */
  .login-panel .field-hint { color:var(--on-scrim); font-size:clamp(0.7rem, 0.85cqw, 0.85rem); }
  .login-panel a { color:var(--on-scrim); }
  .login-submit { margin-top:clamp(0.8rem, 1.6cqw, 1.5rem); padding:0.55em 1rem;
                  font-size:clamp(0.95rem, 1.3cqw, 1.25rem);
                  border-radius:clamp(6px, 0.7cqw, 12px); }
  .login-links, .login-foot { font-size:clamp(0.78rem, 0.95cqw, 0.95rem);
                              margin-top:clamp(0.55rem, 1.15cqw, 1.05rem); }
  .login-foot { padding-top:clamp(0.55rem, 1.15cqw, 1.05rem);
                border-top-color:rgb(255 255 255 / 40%); }
  .login-lang button { color:var(--on-scrim); border-color:rgb(255 255 255 / 55%);
                       font-size:clamp(0.7rem, 0.95cqw, 0.95rem); padding:0.25em 0.6em; }
  .login-lang button:hover { border-color:var(--on-scrim); color:var(--on-scrim);
                             background:rgb(255 255 255 / 14%); }
  /* the chosen language cannot say so with --accent-soft here: it is a pale fill made for a
     white card and it disappears on the stone */
  .login-lang button.current { background:rgb(255 255 255 / 24%); border-color:var(--on-scrim);
                               color:var(--on-scrim); }
}

/* a short, wide window would crop the rock to a strip: give the stage room and let it scroll */
@media (min-width: 1100px) and (max-height: 620px) {
  .login-rock { min-height:30rem; }
}

/* --- phone: no landscape, the lockup above a plain card --------------------------------- */

@media (max-width: 767.98px) {
  .login-lockup { flex-direction:column; align-items:flex-start; gap:0.5rem;
                  padding:1.5rem 1rem 0.5rem; }
  .login-lockup .brand-logo { height:46px; }
  .login-art { padding:1rem 1rem 2rem; align-items:flex-start; }
  .login-panel { padding:1.25rem; }
}
