/*
 * The signed-out pages: sign in, sign up, forgot password, new password.
 *
 * The owner chose this design on the canvas on 2026-09-27 ("A · Ink sketch,
 * six pastries"): a cream page, the form on the left, and on the right a line
 * sketch that draws one pastry at a time on a board under a marigold sun.
 * Every colour is a token in this first block; nothing below names a value.
 * Retoned 2026-10 to the dashboard's warm edition: flour-and-cocoa neutrals,
 * softer corners, the same sketch.
 */
:root {
    --paper:       #F8F3EC;  /* the page */
    --paper-deep:  #F3EBE0;  /* the sketch panel */
    --field:       #FFFCF8;  /* inputs stay white so they read as places to type */
    --ink:         #2D2320;
    --ink-hover:   #4A3B35;
    --on-ink:      #FFFFFF;
    --muted:       #72635A;  /* 5.2:1 on paper, 4.9:1 on the panel */
    --control:     #5A4C44;
    --rule:        #EBE1D4;
    --edge:        #8F7D70;  /* input border, 3.6:1 on paper */
    --placeholder: #857366;
    --wash:        #F3EBE0;  /* behind the Show button on hover */
    --sun:         #F3CF63;
    --error-bg:    #FDEBEC;
    --error-rule:  #F2C9CB;
    --error-ink:   #A3403B;  /* 5.5:1 on its background */
    --ok-bg:       #EDF3EC;
    --ok-rule:     #CFE0CD;
    --ok-ink:      #346538;  /* 6.1:1 on its background */

    --font: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
    --radius: 12px;
    --gutter: 24px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-pen: cubic-bezier(0.65, 0, 0.35, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--ink-hover); }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* --- Layout ----------------------------------------------------------------
   Phones and tablets: one column, the sketch as a band above the heading.
   From 1024px: the form on the left, the sketch filling the right, pinned
   in view while a long form (sign-up) scrolls. */

.signin {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    /* The two empty rows share any spare height, so on a tall tablet the
       sketch and the form sit in the middle; on a phone they are 0. */
    grid-template-areas: "brand" "." "art" "main" "." "foot";
    grid-template-rows: auto 1fr auto auto 1fr auto;
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.signin-brand {
    grid-area: brand;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
}
.signin-mark { width: 28px; height: 28px; flex: none; }
.signin-mark path { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.signin-mark circle { fill: var(--ink); }
.signin-wordmark { font-size: 18px; font-weight: 600; font-style: normal; letter-spacing: -0.01em; }

.signin-art {
    grid-area: art;
    --slot: 4.5s;   /* each pastry: draw, hold, fade */
    --cycle: 27s;   /* six of them; the keyframes below are written for 27s */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px 12px 10px;
    background: var(--paper-deep);
    border: 1px solid var(--rule);
    border-radius: 20px;
}
.sketch-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.sketch { display: block; width: auto; height: clamp(140px, 22vh, 260px); max-width: 100%; overflow: visible; }

.signin-main { grid-area: main; padding: 32px 0 40px; animation: rise 600ms var(--ease-out) both; }

.signin-foot {
    grid-area: foot;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 20px;
    padding: 18px 0 28px;
    border-top: 1px solid var(--rule);
    font-size: 13px;
    color: var(--muted);
}
.signin-foot nav { display: flex; gap: 20px; }
.signin-foot a { color: var(--muted); }
.signin-foot a:hover { color: var(--ink); }

@media (min-width: 1024px) {
    .signin {
        grid-template-columns: clamp(460px, 44vw, 640px) minmax(0, 1fr);
        grid-template-areas: "brand art" "main art" "foot art";
        grid-template-rows: auto 1fr auto;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    .signin-brand { padding: 40px clamp(40px, 5vw, 72px) 0; }
    .signin-main { align-self: center; padding: 48px clamp(40px, 5vw, 72px); }
    .signin-foot { margin: 0 clamp(40px, 5vw, 72px); padding: 20px 0 36px; border-top: 0; }
    .signin-art {
        position: sticky;
        top: 0;
        align-self: start;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: 40px 56px 36px;
        border: 0;
        border-left: 1px solid var(--rule);
        border-radius: 0;
    }
    .sketch { width: 100%; max-width: 620px; height: auto; max-height: 100%; }
}

/* --- Headings, notices, the form ------------------------------------------ */

.signin-title {
    margin: 0;
    font-size: clamp(34px, 4vw, 44px);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.03em;
}
.signin-lede { margin: 14px 0 0; font-size: 17px; line-height: 1.55; color: var(--muted); }
.signin-note { margin: 24px 0 0; font-size: 15px; color: var(--muted); }

.notice {
    margin: 28px 0 0;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.5;
}
.notice-error { background: var(--error-bg); border-color: var(--error-rule); color: var(--error-ink); }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-rule); color: var(--ok-ink); }

.signin-form { display: flex; flex-direction: column; gap: 20px; margin-top: 36px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 14px; font-weight: 500; }

/* "Forgot password?" sits on the label's line but comes after the input in
   the page, so Tab goes from the email straight to the password. */
.field-with-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label link" "input input";
    align-items: baseline;
    column-gap: 12px;
    row-gap: 8px;
}
.field-with-link > .field-label { grid-area: label; }
.field-with-link > .field-secret { grid-area: input; }
.field-with-link > .field-link { grid-area: link; font-size: 14px; }

.field-input {
    width: 100%;
    height: 52px;
    padding: 0 14px;
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    background: var(--field);
    color: var(--ink);
    font: inherit;
    font-size: 16px;  /* 16px or larger, or iPhones zoom in on focus */
    outline: 2px solid transparent;
    outline-offset: 2px;
}
.field-input::placeholder { color: var(--placeholder); }
.field-input:focus-visible { outline-color: var(--ink); }

.field-secret { position: relative; display: flex; }
.field-secret .field-input { padding-right: 76px; }

.reveal {
    position: absolute;
    top: 4px;
    right: 4px;
    height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--control);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: 2px solid transparent;
    outline-offset: 1px;
}
.reveal:hover { background: var(--wash); }
.reveal:focus-visible { outline-color: var(--ink); }
.reveal[hidden] { display: none; }

.btn {
    height: 52px;
    margin-top: 4px;
    border: 0;
    border-radius: 9999px;
    background: var(--ink);
    color: var(--on-ink);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    outline: 2px solid transparent;
    outline-offset: 3px;
    transition: background 160ms ease, transform 160ms ease;
}
.btn:hover { background: var(--ink-hover); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline-color: var(--ink); }

.terms { padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--field); }
.terms-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.terms ul { margin: 0; padding-left: 18px; }
.terms li { margin-bottom: 6px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.terms li:last-child { margin-bottom: 0; }
.terms strong { color: var(--ink); font-weight: 600; }

.agree { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; cursor: pointer; }
.agree input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--ink); cursor: pointer; }

/* --- The sketch ---------------------------------------------------------------
   Every stroke has pathLength="1" and a dash as long as the path with a gap
   twice that, so an offset of 0 shows it whole and animating the offset from
   1 to 0 draws the line. At rest it sits at 1.5, in the middle of the gap:
   at exactly 1 the dash would touch both ends of the path, and round caps
   paint a dot on each. The board, the wheat and the sun come once. The six
   pastries share one 27-second loop, each offset by its slot (--f) and each
   stroke by its place in the drawing (--k). */

.sketch-sun {
    fill: var(--sun);
    transform-box: fill-box;
    transform-origin: center;
    animation: sketch-sun 900ms var(--ease-out) both;
}

.sketch-once, .sketch-line {
    fill: none;
    stroke: var(--ink);
    stroke-width: 3.5;  /* the band on a phone draws small; 2.25 from 1024px */
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1 2;
    stroke-dashoffset: 1.5;
}
.sketch-chip { stroke-width: 7; }

.sketch-once { animation: sketch-draw 1600ms var(--ease-pen) forwards; }
.sketch-wheat > .sketch-once { animation-delay: calc(1.15s + var(--k, 0) * 0.1s); }

.sketch-line {
    animation: sketch-cycle var(--cycle) var(--ease-pen) infinite both;
    animation-delay: calc(var(--f, 0) * var(--slot) + 0.25s + var(--k, 0) * 0.15s);
}
.sketch-fig {
    animation: sketch-slot var(--cycle) linear infinite both;
    animation-delay: calc(var(--f, 0) * var(--slot));
}
.f0 { --f: 0; } .f1 { --f: 1; } .f2 { --f: 2; } .f3 { --f: 3; } .f4 { --f: 4; } .f5 { --f: 5; }

.sketch g > :nth-child(2)  { --k: 1; }
.sketch g > :nth-child(3)  { --k: 2; }
.sketch g > :nth-child(4)  { --k: 3; }
.sketch g > :nth-child(5)  { --k: 4; }
.sketch g > :nth-child(6)  { --k: 5; }
.sketch g > :nth-child(7)  { --k: 6; }
.sketch g > :nth-child(8)  { --k: 7; }
.sketch g > :nth-child(9)  { --k: 8; }
.sketch g > :nth-child(10) { --k: 9; }

.sketch-caption {
    display: grid;
    width: 100%;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.sketch-caption > p { grid-area: 1 / 1; display: flex; justify-content: center; gap: 24px; margin: 0; }
.sketch-caption .sketch-name { white-space: pre; }
.sketch-caption .sketch-note { display: none; }

@media (min-width: 1024px) {
    .sketch-once, .sketch-line { stroke-width: 2.25; }
    .sketch-chip { stroke-width: 5.5; }
    .sketch-caption > p { justify-content: space-between; }
    .sketch-caption .sketch-note { display: inline; }
}

/* 27s loop: draw in 1.2s (4.5%), hold, fade out 3.9s to 4.3s into the slot,
   reset unseen, wait for the other five. */
@keyframes sketch-cycle {
    0%    { stroke-dashoffset: 1.5; }
    0.01% { stroke-dashoffset: 1; }
    4.5%  { stroke-dashoffset: 0; }
    17%   { stroke-dashoffset: 0; }
    17.5% { stroke-dashoffset: 1.5; }
    100%  { stroke-dashoffset: 1.5; }
}
@keyframes sketch-slot {
    0%    { opacity: 0; }
    0.4%  { opacity: 1; }
    14.5% { opacity: 1; }
    16%   { opacity: 0; }
    100%  { opacity: 0; }
}
@keyframes sketch-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes sketch-sun {
    from { opacity: 0; transform: translate(-14px, 14px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* Asked for less motion: the loaf, drawn and still, and nothing else moves. */
@media (prefers-reduced-motion: reduce) {
    .signin-main, .sketch-sun { animation: none; }
    .sketch-once, .sketch-line { animation: none; stroke-dashoffset: 0; }
    .sketch-fig { animation: none; opacity: 0; }
    .sketch-fig.f0 { opacity: 1; }
    .btn { transition: none; }
    .btn:active { transform: none; }
}
