/* =============================================================================
   Arles — the shell. Follows the Arles design language in
   docs/design/design-language.md: cool off-white surfaces, one violet accent
   that only ever marks state, mono for counts and measures, 7px radius.
   ============================================================================= */
:root{
  color-scheme: light;

  --bg:#eef1f4;
  --surface:#ffffff;
  --surface-2:#f6f8fa;
  --ink:#141a20;
  --muted:#5a6773;
  --line:#dde3e9;

  --signal:#5346b8;
  --signal-strong:#3f3496;
  --signal-tint:#eeecfa;
  --on-signal:#ffffff;

  --up:#1f9d57;
  --down:#d64545;
  --warn:#c17d12;
  --starting:#2f6fed;
  --idle:#8a94a0;

  --font-ui:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --font-mono:ui-monospace,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;

  --radius:7px;
  --radius-sm:5px;
  --shadow:0 1px 2px rgba(20,26,32,.06), 0 5px 18px rgba(20,26,32,.05);
  --wire:linear-gradient(90deg,var(--signal),#8b82e0 60%,transparent);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
  background:var(--bg);color:var(--ink);font-family:var(--font-ui);
  font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased;
  display:flex;flex-direction:column;overflow:hidden;
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
textarea,input,select{font:inherit;color:inherit}
.mono{font-family:var(--font-mono)}
a{color:var(--signal-strong);text-decoration:none}
a:hover{text-decoration:underline}
a:focus-visible,button:focus-visible,textarea:focus-visible,select:focus-visible,
input:focus-visible{outline:2px solid var(--signal);outline-offset:2px;border-radius:var(--radius-sm)}
[hidden]{display:none!important}

/* ---------- shell ---------- */
.shell{flex:1;display:grid;grid-template-columns:240px minmax(0,1fr);min-height:0}

/* ---------- the narrow-screen chrome ----------
   Above 760px none of this exists: the rail is the rail, and the topbar, the
   hamburger and the scrim are all display:none. Below it the rail becomes a
   drawer and these three carry it. Stated here so the "off" state is written
   once rather than implied. */
.topbar,.rail-scrim,.rail-close{display:none}

.sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0;
}

/* The bars and the cross are drawn from box-shadow rather than from an icon
   set. Arles has one drawn mark and a hamburger is not worth becoming the
   second. Both are 18px wide and take the control's own colour. */
.nav-bars,.nav-cross{display:block;width:18px;height:2px;position:relative}
.nav-bars{background:currentColor;border-radius:2px;
  box-shadow:0 -6px 0 currentColor,0 6px 0 currentColor}
.nav-cross::before,.nav-cross::after{
  content:"";position:absolute;left:0;top:0;
  width:18px;height:2px;background:currentColor;border-radius:2px;
}
.nav-cross::before{transform:rotate(45deg)}
.nav-cross::after{transform:rotate(-45deg)}

/* Both drawer controls are a 44px target, which is the floor for a thumb.
   The 34px a .btn gets is right for a mouse and wrong for this. */
.nav-toggle,.rail-close{
  align-items:center;justify-content:center;
  width:44px;height:44px;flex:none;padding:0;
  border-radius:var(--radius-sm);color:var(--ink);
}
.nav-toggle:hover,.rail-close:hover{background:var(--surface-2)}

/* ---------- rail ---------- */
.rail{
  background:var(--surface);border-right:1px solid var(--line);
  display:flex;flex-direction:column;min-height:0;
}
.rail-head{display:flex;align-items:center;gap:9px;padding:16px 16px 14px}
.rail-head a{display:flex;align-items:center;gap:9px;color:var(--ink)}
.rail-head a:hover{text-decoration:none}
.brand-mark{flex:none;display:block;object-fit:contain}
.brand{font-size:17px;font-weight:640;letter-spacing:-.01em}
/* The mark and the word as one way home, on every page that has a header of
   its own rather than the rail. */
.head-brand{display:flex;align-items:center;gap:9px;color:var(--ink)}
.head-brand:hover{text-decoration:none}
.rail-scroll{flex:1;overflow-y:auto;padding:0 10px 12px}
.nav-group{padding:8px 0}
.nav-group + .nav-group{border-top:1px solid var(--line)}
.eyebrow{
  font-size:10.5px;font-weight:600;letter-spacing:.13em;text-transform:uppercase;
  color:var(--muted);padding:6px 8px 8px;
}
.nav{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;width:100%;
  text-align:left;padding:8px 10px;border-radius:var(--radius-sm);color:var(--ink);
  font-size:14.5px;line-height:1.35;
}
.nav:hover{background:var(--surface-2);text-decoration:none}
.nav.on{background:var(--signal-tint);color:var(--signal-strong);font-weight:600}
.nav .n{font-family:var(--font-mono);font-size:12px;color:var(--muted);font-weight:400;flex:none}
.nav.on .n{color:var(--signal-strong)}
.nav span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rail-empty{padding:2px 10px 8px;font-size:13.5px;color:var(--muted)}
.rail-foot{border-top:1px solid var(--line);padding:12px;display:flex;flex-direction:column;gap:8px}

/* the settings menu, at the foot of the rail */
.menu{position:relative}
.menu-sheet{
  position:absolute;left:0;right:0;bottom:calc(100% + 6px);z-index:20;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:5px;display:flex;flex-direction:column;
}
.menu-sheet a,.menu-sheet button{
  text-align:left;padding:8px 10px;border-radius:var(--radius-sm);
  font-size:14px;color:var(--ink);width:100%;
}
.menu-sheet a:hover,.menu-sheet button:hover{background:var(--surface-2);text-decoration:none}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:8px 14px;border:1px solid var(--line);border-radius:var(--radius);
  background:var(--surface);color:var(--ink);font-size:14px;font-weight:600;
  box-shadow:0 1px 1px rgba(20,26,32,.04);
}
.btn:hover{background:var(--surface-2);text-decoration:none}
.btn.primary{background:var(--signal);border-color:var(--signal);color:var(--on-signal)}
.btn.primary:hover{background:var(--signal-strong);border-color:var(--signal-strong)}
.btn.block{width:100%}
.btn.small{padding:6px 11px;font-size:13px}
.btn.quiet{border-color:transparent;box-shadow:none;background:none;font-weight:500;color:var(--muted)}
.btn.quiet:hover{background:var(--surface-2);color:var(--ink)}
.btn[disabled]{opacity:.5;cursor:not-allowed}

/* ---------- main ---------- */
.main{display:flex;flex-direction:column;min-width:0;min-height:0}

/* A shared folder and the landing page have no rail and no shell, so what
   they render is the whole page. */
body.public .main,body.public .landing{flex:1;min-height:0}
.scroll{flex:1;overflow-y:auto;padding:26px 32px 26px}
.inner{max-width:1000px;margin:0 auto}

.page-head{display:flex;align-items:flex-start;gap:16px;margin-bottom:20px}
.page-head .eyebrow{padding:0 0 5px}
.page-head h1{margin:0;font-size:22px;font-weight:640;letter-spacing:-.01em}
.page-head .sub{margin:5px 0 0;font-size:13.5px;color:var(--muted)}
.spacer{flex:1}

/* cards */
.card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow);margin-bottom:18px;overflow:hidden;
}
.card-h{
  display:flex;align-items:center;gap:12px;padding:11px 16px;
  border-bottom:1px solid var(--line);background:var(--surface-2);
  font-size:14px;font-weight:600;
}
.card-h .id{font-family:var(--font-mono);font-weight:600}
.card-b{padding:16px}
.card-f{
  display:flex;align-items:center;gap:14px;padding:11px 16px;
  border-top:1px solid var(--line);background:var(--surface-2);flex-wrap:wrap;
}

.pill{
  display:inline-flex;align-items:center;gap:6px;padding:2px 9px;border-radius:999px;
  font-size:11.5px;font-weight:600;letter-spacing:.02em;
  border:1px solid var(--line);background:var(--surface);color:var(--muted);
}
.pill.live{border-color:var(--signal);background:var(--signal-tint);color:var(--signal-strong)}
.dot{width:7px;height:7px;border-radius:50%;background:var(--idle);flex:none}
.dot.working{background:var(--starting);animation:blink 1.6s ease-in-out infinite}
.dot.done{background:var(--up)}
.dot.bad{background:var(--down)}
.dot.warn{background:var(--warn)}
@keyframes blink{0%,100%{opacity:.35}50%{opacity:1}}

/* the prompt */
.prompt{
  background:var(--surface-2);border:1px solid var(--line);border-radius:var(--radius-sm);
  padding:13px 15px;font-size:15.5px;line-height:1.62;color:#232c34;max-width:78ch;
  white-space:pre-wrap;margin:0;
}
.prompt.clamped{max-height:6.3em;overflow:hidden;position:relative}
.prompt.clamped::after{
  content:"";position:absolute;left:0;right:0;bottom:0;height:2.4em;
  background:linear-gradient(rgba(246,248,250,0),var(--surface-2));
}
.readmore{display:inline-block;margin-top:9px;font-size:13px;font-weight:600}
/* The share line: one pill, the link, and the control that copies it. A folder
   screen and a session screen both draw it, so it is here and not in either
   module's stylesheet. */
.share-line{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:8px;max-width:760px}
/* The warning about what a link lets a stranger do reads across the line the
   link itself sits on, not in a 52ch column beside it. */
.share-line + .note{max-width:76ch;margin-bottom:18px}
.share-line .field{flex:1;min-width:260px;min-height:0;padding:8px 11px;font-size:13px;
  background:var(--surface-2);color:var(--muted)}
.share-line .field:focus{color:var(--ink)}

.note{font-size:13px;color:var(--muted);margin:0;max-width:52ch}
.note.bad{color:var(--down)}

/* forms */
.field{
  width:100%;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-sm);
  padding:11px 13px;font-size:15px;line-height:1.6;resize:vertical;min-height:76px;
}
.field:focus{outline:none;border-color:var(--signal);box-shadow:0 0 0 3px rgba(83,70,184,.13)}
.field::placeholder{color:#93a0ac}
input.field{min-height:0}
.label{display:block;font-size:13px;font-weight:600;color:var(--muted);margin-bottom:6px}
.row{margin-bottom:16px}
.check{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--muted)}
.error{color:var(--down);font-size:13px;margin:6px 0 0}
.told{
  border-left:2px solid var(--up);background:#eefaf2;border-radius:0 var(--radius-sm) var(--radius-sm) 0;
  padding:10px 13px;font-size:14px;margin-bottom:16px;
}
.told.closed{border-left-color:var(--warn);background:#fdf5e7;color:#7a5410}

/* A credential shown once: the token, and the verification link. Readonly and
   selected on click, because it is copied and never typed. */
.token-line{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.token-line .field{flex:1;min-width:220px;min-height:0;padding:8px 11px;font-size:13px;
  background:var(--surface-2)}
.under{margin:14px 0 0;font-size:13.5px;text-align:center}

/* lightbox */
.lb{position:fixed;inset:0;background:rgba(20,26,32,.86);z-index:60;display:flex;
  flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:40px}
.lb .big{max-width:min(74vw,1100px);max-height:70vh;border-radius:var(--radius);
  border:5px solid #fff;box-shadow:0 20px 60px rgba(0,0,0,.45);background:#fff}
.lb .cap{max-width:74ch;text-align:center;color:#e9edf1;font-size:14.5px;line-height:1.6;margin:0;
  max-height:22vh;overflow-y:auto}
.lb .bar{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.lb .close{position:absolute;top:18px;right:24px;font-size:26px;line-height:1;color:#aab3bc}
.lb .close:hover{color:#fff}

/* One image back and one forward, for a screen that has no arrow keys. They sit
   over the edges of the view rather than under the picture, so a thumb reaches
   them where it already is. */
.lb .step{
  position:absolute;top:50%;transform:translateY(-50%);z-index:1;
  display:flex;align-items:center;justify-content:center;
  width:40px;height:56px;border-radius:var(--radius);
  background:rgba(20,26,32,.42);border:1px solid rgba(255,255,255,.22);
  color:#e9edf1;font-size:28px;line-height:1;padding-bottom:3px;
}
.lb .step:hover{background:rgba(20,26,32,.72);color:#fff}
.lb .step.prev{left:14px}
.lb .step.next{right:14px}

/* ---------- filing: the star and the plus ----------
   They sit on a tile and in the large view's action bar, so an image is filed
   where it is looked at. On a tile they appear on hover; on a touch screen
   there is no hover, so they are always shown. */
.filing{display:flex;gap:4px}
.filing.tile{
  position:absolute;top:9px;right:9px;z-index:2;
  opacity:0;transition:opacity .12s ease;
}
.frame:hover .filing.tile,.tile:hover .filing.tile,
.filing.tile:focus-within{opacity:1}
.fbtn{
  display:flex;align-items:center;justify-content:center;width:26px;height:26px;
  border-radius:var(--radius-sm);border:1px solid var(--line);
  background:rgba(255,255,255,.94);color:var(--muted);
  font-size:15px;line-height:1;box-shadow:0 1px 3px rgba(20,26,32,.18);
}
.fbtn:hover{background:#fff;color:var(--signal-strong);border-color:var(--signal)}
.fbtn.on{color:var(--signal);border-color:var(--signal);background:var(--signal-tint)}
.filing.bar .fbtn{width:32px;height:32px;font-size:17px;background:var(--surface)}

/* the add-to-folder panel: a fixed size with the list scrolling inside it, so
   a hundred folders never change its shape */
.picker-back{position:fixed;inset:0;background:rgba(20,26,32,.5);z-index:70;
  display:flex;align-items:center;justify-content:center;padding:24px}
.picker{
  width:340px;max-width:100%;height:420px;max-height:100%;
  display:flex;flex-direction:column;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:0 20px 60px rgba(0,0,0,.3);overflow:hidden;
}
.picker-h{
  display:flex;align-items:center;gap:10px;padding:11px 14px;
  border-bottom:1px solid var(--line);background:var(--surface-2);
  font-size:14px;font-weight:600;
}
.picker-h .close{margin-left:auto;font-size:22px;line-height:1;color:var(--muted)}
.picker-h .close:hover{color:var(--ink)}
.picker-list{flex:1;overflow-y:auto;padding:6px}
.picker-row{
  display:flex;align-items:center;gap:9px;width:100%;text-align:left;
  padding:8px 10px;border-radius:var(--radius-sm);font-size:14.5px;
}
.picker-row:hover{background:var(--surface-2)}
.picker-row .tick{
  flex:none;width:18px;height:18px;display:flex;align-items:center;justify-content:center;
  border:1px solid var(--line);border-radius:4px;font-size:12px;color:var(--signal);
  background:var(--surface);
}
.picker-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.picker-row .n{margin-left:auto;font-size:12px;color:var(--muted)}
.picker-empty{padding:10px}
.picker-f{display:flex;gap:8px;padding:10px;border-top:1px solid var(--line);background:var(--surface-2)}
.picker-f .field{flex:1;min-height:0;padding:7px 10px;font-size:14px}

/* a screen that is only a form */
.sheet-page{max-width:560px;margin:0 auto}
.centred{flex:1;display:flex;align-items:center;justify-content:center;padding:32px;overflow-y:auto}

/* =============================================================================
   Narrow screens
   Two breakpoints, and they answer two different questions. 900px is about the
   pictures: below it a 212px tile and a 240px rail no longer sit side by side
   comfortably, so the grid goes to two columns. 760px is about the navigation:
   below it the rail becomes a drawer. A landscape tablet keeps its rail and
   gets the wider grid, which is the point of having two.
   ============================================================================= */

/* The picture grids belong to their own modules and are set there, because
   gallery.css and studio.css are pushed after this file and would otherwise
   win. */

[x-cloak]{display:none!important}

/* SweetAlert2 brings its own styles; these bring it into the design language. */
.swal2-popup{border-radius:var(--radius);font-family:var(--font-ui);background:var(--surface)}
.swal2-title{font-size:19px;font-weight:640;color:var(--ink)}
.swal2-html-container{font-size:14.5px;color:var(--muted)}
.swal2-actions{gap:10px}
.swal2-toast{border:1px solid var(--line);box-shadow:var(--shadow)}

@media (hover:none){
  .filing.tile{opacity:1}
}

@media (max-width:900px){
  .scroll{padding:18px 16px}
  .page-head{flex-wrap:wrap;gap:10px}
}

@media (max-width:760px){
  .token-line .field{flex:1 1 100%;min-width:0}

  .share-line{gap:8px}
  .share-line .field{flex:1 1 100%;min-width:0}

  /* Three rows, placed by hand rather than left to auto-placement: the bar,
     the rail, the page. With scripting the rail is a fixed drawer and its row
     simply collapses to nothing; without it the rail keeps that row and sits
     above the page as a block, which is the fallback below. */
  .shell{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr)}
  .topbar{grid-row:1}
  .rail{grid-row:2}
  .main{grid-row:3}

  /* No scripting, so there is nothing to open a drawer with. The rail is a
     block above the page and the bar that would have opened it is not drawn.
     Half the screen is the cap, or a long sessions list would push the page
     off the bottom. */
  html:not(.js) .topbar{display:none}
  html:not(.js) .rail{max-height:50vh;overflow-y:auto;border-right:0;border-bottom:1px solid var(--line)}

  /* The bar the page always has. The body does not scroll, so it stays put
     without being sticky: the way back to the navigation is never a scroll to
     the top. */
  .topbar{
    display:flex;align-items:center;gap:6px;z-index:30;
    padding:6px 10px;min-width:0;
    background:var(--surface);border-bottom:1px solid var(--line);
  }
  .topbar-brand{display:flex;align-items:center;gap:9px;
    font-size:15px;font-weight:640;letter-spacing:-.01em;color:var(--ink)}
  .topbar-brand:hover{text-decoration:none}
  .nav-toggle{display:inline-flex}

  /* The drawer, only where there is scripting to open it. Without .js the rail
     below stays the static block it renders as anyway, so a scriptless browser
     gets a navigation it can reach rather than one it cannot. */
  .js .rail{
    position:fixed;top:0;bottom:0;left:0;z-index:45;
    width:min(19rem,84vw);
    overflow-y:auto;overscroll-behavior:contain;
    border-right:1px solid var(--line);box-shadow:var(--shadow);
    transform:translateX(-100%);
    /* Hidden, not merely moved off screen. A drawer that is only translated
       still holds every link in the tab order, so a keyboard lands in
       navigation nobody can see. The delay keeps it on screen for the whole
       slide out. */
    visibility:hidden;
    transition:transform .18s ease,visibility 0s linear .18s;
  }
  body.nav-open .rail{transform:translateX(0);visibility:visible;
    transition:transform .18s ease,visibility 0s}

  .js .rail-scrim{
    display:block;position:fixed;inset:0;z-index:40;
    background:rgba(20,26,32,.42);
    opacity:0;pointer-events:none;transition:opacity .18s ease;
  }
  body.nav-open .rail-scrim{opacity:1;pointer-events:auto}

  /* The mark and the way out, on one line. */
  .js .rail-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
  .js .rail-close{display:inline-flex}

  /* A tap target is a thumb, not a pointer. */
  .btn{min-height:42px;padding:10px 16px}
  .btn.small{min-height:38px;padding:8px 13px}
  .nav{padding:11px 10px}

  .page-head h1{font-size:20px}

  /* A card header carrying a sentence in a pill: the pill takes its own line
     rather than being squeezed into a two-line lozenge beside the title. */
  .card-h{flex-wrap:wrap}

  /* The large view: the picture takes the room, the actions wrap under it. */
  /* The top padding is the close control's room: the view starts at the top
     of the screen, so without it the cross sits on the picture. */
  .lb{padding:46px 12px 18px;gap:12px;justify-content:flex-start}
  .lb .big{max-width:100%;max-height:56vh;border-width:3px}
  .lb .cap{max-height:16vh;font-size:13.5px}
  .lb .bar{gap:8px}
  .lb .close{top:8px;right:12px}

  /* The picture is no longer centred on the screen, so the two steps follow it
     to the top instead of sitting beside the caption. */
  .lb .step{top:calc(46px + 28vh);transform:none;width:34px;height:48px;font-size:24px}
  .lb .step.prev{left:6px}
  .lb .step.next{right:6px}

  /* The add-to-folder panel, which is a fixed size on a desktop on purpose,
     takes what the screen has instead of overflowing it. */
  .picker-back{padding:14px}
  .picker{width:100%;height:min(420px,80vh)}

  .centred{padding:18px 16px}
}

@media (max-width:420px){
  .scroll{padding:14px 12px}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition:none!important}
}
