/* The app's sign-in screen (gate.js). Loaded by the app only, after styles.css, whose
   tokens it uses. One card, two halves: a forest-green panel on the left (logo, the way
   back to the main site, three rotating messages with their pictures) and the form on
   the right. */

/* The sign-in screen fills the window exactly and never scrolls: the card takes what's
   left above the site footer, up to 720px tall. No site header; the card has the logo. */
html.gating, html.gating body { height: 100%; overflow: hidden; }
html.gating header.top { display: none; }
html.gating .wrap {
  height: 100vh; height: 100dvh; max-width: 1080px; padding: var(--sp-5) var(--sp-5) var(--sp-4);
  display: flex; flex-direction: column; justify-content: center;
}
.gate { flex: 0 1 720px; min-height: 0; }
html.gating .site-foot { flex: none; margin-top: var(--sp-4); padding-top: var(--sp-3); }
.gate-card {
  height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: var(--sp-3);
  padding: var(--sp-3); border-radius: 16px; background: var(--paper-raised); box-shadow: var(--shadow-3);
}

/* Left: the panel */
.gate-panel {
  position: relative; overflow: hidden; border-radius: 12px; min-height: 0;
  display: flex; flex-direction: column; padding: var(--sp-5); color: #fff;
  background: radial-gradient(120% 70% at 20% 0%, #3B7061 0%, var(--accent) 45%, #1F4137 100%);
}
/* The week card runs off the bottom of the panel, under a fade to the panel's own green. */
.gate-panel::after { transition: opacity .7s var(--ease); }
.gate-panel:not([data-at="0"])::after { opacity: 0; }
.gate-panel::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 44%; pointer-events: none;
  background: linear-gradient(to bottom, rgba(31, 65, 55, 0) 0%, rgba(31, 65, 55, 0.96) 34%, #1F4137 56%);
}
.gate-panel-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); position: relative; z-index: 1; }
.gate-logo { line-height: 0; }
.gate-logo img { height: 32px; width: auto; filter: brightness(0) invert(1); }
.gate-back {
  display: inline-flex; align-items: center; gap: var(--sp-1); height: 34px; padding: 0 var(--sp-2) 0 var(--sp-4);
  border-radius: 99px; background: rgba(255, 255, 255, 0.14); color: #fff; text-decoration: none;
  font-size: var(--fs-small); font-weight: 600; transition: background-color .15s var(--ease);
}
.gate-back:hover { background: rgba(255, 255, 255, 0.24); }
.gate-back .ic { width: 14px; height: 14px; }
.gate-back:focus-visible, .gate-dots button:focus-visible, .gate-logo:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* The panel's three pictures, one per message, stacked in one spot. The one showing
   fades and rises in with a soft focus pull; the others fade back out. */
.gate-visuals { flex: 1 1 auto; min-height: 0; position: relative; display: grid; margin: var(--sp-6) var(--sp-3) 0; }
.gate-visual {
  grid-area: 1 / 1; min-height: 0; opacity: 0; pointer-events: none;
  transform: translateY(16px) scale(0.97); filter: blur(6px);
  transition: opacity .7s var(--ease), transform .9s var(--ease), filter .7s var(--ease);
}
.gate-visual.on { opacity: 1; transform: none; filter: none; transition-delay: .12s; }
@media (prefers-reduced-motion: reduce) { .gate-visual, .gate-visual.on { transform: none; filter: none; } }

/* 1. This week, in miniature, dated this week, running off the bottom of the panel. */
.gate-week {
  align-self: start; overflow: hidden; color: var(--ink);
  background: var(--paper-raised); border-radius: 12px; padding: var(--sp-4) var(--sp-4) 0;
  box-shadow: 0 8px 20px rgba(10, 30, 24, 0.25), 0 30px 60px rgba(10, 30, 24, 0.30);
}
.gw-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.gw-title { font-size: var(--fs-lead); font-weight: 800; letter-spacing: -0.02em; margin-right: var(--sp-2); }
.gw-range { font-size: var(--fs-small); color: var(--muted); }
.gw-days { list-style: none; margin: 0; padding: 0; }
.gw-day {
  display: grid; grid-template-columns: 44px 1fr; gap: var(--sp-2); padding: var(--sp-2);
  border-top: 1px solid var(--line); border-radius: var(--r-s);
}
.gw-day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.gw-dow { display: flex; flex-direction: column; line-height: 1.2; }
.gw-dow b { font-size: var(--fs-caption); font-weight: 700; color: var(--muted); }
.gw-dow i { font-style: normal; font-size: var(--fs-lead); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.gw-day.today { background: var(--accent-soft); border-top-color: transparent; }
.gw-day.today + .gw-day { border-top-color: transparent; }
.gw-day.today .gw-dow b, .gw-day.today .gw-dow i { color: var(--accent); }
.gw-item { display: flex; gap: var(--sp-2); align-items: flex-start; }
.gw-item b { display: block; font-size: var(--fs-small); font-weight: 600; }
.gw-item small { font-size: var(--fs-caption); color: var(--muted); }
/* A class-colored check box for assignments; a class-colored bar for events. */
.gw-tick {
  width: 14px; height: 14px; margin-top: 1px; flex: none; border-radius: 4px;
  border: 1.5px solid var(--c); display: grid; place-content: center;
}
.gw-event .gw-tick { width: 4px; height: 28px; margin: 0 var(--sp-1); border: 0; border-radius: 99px; background: var(--c); }
.gw-day.past .gw-dow { opacity: .55; }
.gw-day.past .gw-item b { color: var(--faint); text-decoration: line-through; font-weight: 500; }
.gw-day.past .gw-item small { color: var(--faint); }
.gw-day.past .gw-item:not(.gw-event) .gw-tick { background: var(--c); opacity: .5; }
.gw-day.past .gw-item:not(.gw-event) .gw-tick::after {
  content: ""; width: 7px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(0.5px, -1px);
}
.gw-day.past .gw-event .gw-tick { opacity: .4; }
.gw-day.soon .gw-item:not(.gw-event) small { color: var(--flag); font-weight: 600; }

/* 2. Read-only: what Clew can and can't do with the calendar. */
.gv-access, .gv-node {
  color: var(--ink); background: var(--paper-raised); border-radius: 12px;
  box-shadow: 0 8px 20px rgba(10, 30, 24, 0.25), 0 30px 60px rgba(10, 30, 24, 0.30);
}
.gv-access { align-self: start; margin: var(--sp-5) var(--sp-4) 0; padding: var(--sp-5); }
.gv-app, .gv-node { display: flex; align-items: center; gap: var(--sp-3); }
.gv-app { padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.gv-app b, .gv-node b { display: block; font-size: var(--fs-body); font-weight: 700; }
.gv-app small, .gv-node small { display: block; font-size: var(--fs-small); color: var(--muted); }
.gv-mark {
  width: 36px; height: 36px; flex: none; border-radius: var(--r-m); display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.gv-mark .ic { width: 18px; height: 18px; }
.gv-badge {
  margin-left: auto; font-size: var(--fs-small); font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 2px var(--sp-2); border-radius: 99px; white-space: nowrap;
}
.gv-sub { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--fs-small); font-weight: 700; color: var(--muted); }
.gv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.gv-list li { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-body); }
.gv-list [data-icon] { width: 20px; height: 20px; flex: none; border-radius: 99px; display: grid; place-items: center; }
.gv-list .ic { width: 12px; height: 12px; stroke-width: 2.5; }
.gv-list .yes [data-icon] { background: var(--accent-soft); color: var(--accent); }
.gv-list .no { color: var(--muted); }
.gv-list .no [data-icon] { background: var(--flag-soft); color: var(--flag); }

/* 3. Where the calendar goes: Google -> this browser, and never on to Clew's servers. */
.gv-flow { align-self: start; margin: var(--sp-5) var(--sp-6) 0; display: flex; flex-direction: column; }
.gv-node { padding: var(--sp-3) var(--sp-4); }
.gv-you .gv-mark { background: var(--accent); color: #fff; }
.gv-server { background: rgba(255, 255, 255, 0.08); color: #fff; box-shadow: none; border: 1px dashed rgba(255, 255, 255, 0.45); }
.gv-server small { color: #BFD6CC; }
.gv-server .gv-mark { background: rgba(255, 255, 255, 0.12); color: #fff; }
.gv-link { position: relative; height: 52px; }
.gv-link span { position: absolute; left: 33px; top: 0; bottom: 0; width: 2px; background: #fff; }
.gv-link.off span { background: none; border-left: 2px dashed rgba(255, 255, 255, 0.5); }
.gv-link em {
  position: absolute; left: 50px; top: 50%; transform: translateY(-50%);
  font-style: normal; font-size: var(--fs-small); font-weight: 600; color: #fff;
}
.gv-link.off em { color: #BFD6CC; }

/* The rotating promise, bottom of the panel */
.gate-slides { position: relative; z-index: 1; margin-top: calc(-1 * var(--sp-9)); text-align: center; }
.gate-slide-track { display: grid; }
.gate-slide {
  grid-area: 1 / 1; margin: 0 auto; max-width: 20ch; align-self: end;
  font-size: clamp(1.4rem, 2.2vw, 1.75rem); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance;
  opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease), transform .5s var(--ease); pointer-events: none;
}
.gate-slide span { color: #BFD6CC; }
.gate-slide.on { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .gate-slide { transform: none; } }
.gate-dots { display: flex; justify-content: center; gap: 0; margin-top: var(--sp-4); }
.gate-dots button { padding: var(--sp-3) var(--sp-1); background: none; border: 0; cursor: pointer; }
.gate-dots button::before {
  content: ""; display: block; width: 22px; height: 3px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.35); transition: width .3s var(--ease), background-color .3s var(--ease);
}
.gate-dots button.on::before { width: 34px; background: #fff; }

/* Right: the form */
/* On a very short window the form scrolls inside the card rather than getting cut off. */
.gate-main { display: flex; flex-direction: column; padding: var(--sp-6); min-height: 0; overflow-y: auto; }
.gate-main > .gate-step { margin: auto; }
.gate-step { width: 100%; max-width: 400px; animation: fade-in .35s var(--ease); }
.gate-title { font-size: clamp(1.875rem, 3vw, 2.375rem); line-height: 1.08; letter-spacing: -0.03em; font-weight: 800; margin: 0 0 var(--sp-3); text-wrap: balance; }
.gate-title:focus { outline: none; }
.gate-switch { margin: 0 0 var(--sp-6); font-size: var(--fs-lead); color: var(--muted); line-height: 1.5; }
.gate-switch .demo-link { font-size: inherit; }
.gate-switch b { color: var(--ink); font-weight: 600; word-break: break-all; }
.gate-form { display: grid; gap: var(--sp-2); }
.gate-label { font-size: var(--fs-small); font-weight: 600; color: var(--ink); }
.gate-input {
  height: 50px; padding: 0 var(--sp-4); border-radius: var(--r-m); border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink); font: inherit; font-size: var(--fs-lead);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.gate-input::placeholder { color: var(--faint); }
.gate-input:hover { border-color: var(--muted); }
.gate-input:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gate-input[aria-invalid="true"] { border-color: var(--flag); box-shadow: 0 0 0 3px var(--flag-soft); }
.gate-otp { font-size: var(--fs-title); font-weight: 700; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.gate-note { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.gate-note-center { text-align: center; margin-top: var(--sp-2); }
.gate-submit {
  height: 50px; margin-top: var(--sp-3); border-radius: var(--r-m); border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-size: var(--fs-lead); font-weight: 600;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.gate-submit:hover { background: #244a3f; border-color: #244a3f; }
.gate-submit:disabled { opacity: .65; cursor: progress; }
.gate .landing-msg { max-width: none; }
.gate-or {
  display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-6) 0 var(--sp-4);
  font-size: var(--fs-small); color: var(--muted);
}
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gate-signin {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3); width: 100%; height: 50px;
  background: #fff; color: #1f1f1f; border: 1px solid var(--line-strong); border-radius: var(--r-m);
  font-size: var(--fs-lead); font-weight: 600;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.gate-signin .g-mark { width: 20px; height: 20px; }
.gate-signin:hover { border-color: var(--ink); box-shadow: var(--shadow-1); }
.gate-signin:disabled { opacity: .6; cursor: progress; }
.gate-fine { margin: var(--sp-6) 0 0; font-size: var(--fs-small); color: var(--muted); line-height: 1.5; }
.gate-fine a { color: var(--ink); text-underline-offset: 2px; }
.gate-fine a:hover { color: var(--accent); }
.gate-alt { margin: var(--sp-3) 0 0; font-size: var(--fs-body); color: var(--muted); }
.gate-code-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.gate-code-actions span { color: var(--faint); }
#gate-code .gate-note { margin-top: var(--sp-3); }
.demo-link:disabled { color: var(--muted); text-decoration: none; cursor: default; font-weight: 600; }

@media (max-width: 860px) {
  html.gating .wrap { padding: var(--sp-3) var(--sp-3) var(--sp-2); justify-content: stretch; }
  .gate { flex: 1 1 auto; }
  html.gating .site-foot { margin-top: var(--sp-2); padding-top: var(--sp-2); row-gap: 0; font-size: var(--fs-caption); }
  .gate-card { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); padding: var(--sp-2); gap: var(--sp-2); }
  .gate-panel { padding: var(--sp-3) var(--sp-4) var(--sp-1); }
  .gate-visuals, .gate-panel::after { display: none; }
  .gate-slides { margin-top: var(--sp-4); }
  .gate-slide { font-size: var(--fs-lead); max-width: 30ch; }
  .gate-dots { margin-top: 0; }
  .gate-main { padding: var(--sp-5) var(--sp-3) var(--sp-4); }
  .gate-title { font-size: clamp(1.75rem, 7vw, 2rem); }
  .gate-switch { margin-bottom: var(--sp-5); font-size: var(--fs-body); }
  .gate-or { margin: var(--sp-5) 0 var(--sp-3); }
  .gate-fine { margin-top: var(--sp-4); }
}
/* Small phones: the tightest spacing, so the form and the footer both fit. */
@media (max-width: 860px) and (max-height: 720px) {
  html.gating .gate-main { padding-top: var(--sp-3); padding-bottom: var(--sp-2); }
  html.gating .gate-title { margin-bottom: var(--sp-2); }
  html.gating .gate-switch { margin-bottom: var(--sp-3); }
  html.gating .gate-or { margin: var(--sp-3) 0 var(--sp-2); }
  html.gating .gate-note-center { display: none; }
  html.gating .gate-fine { margin-top: var(--sp-3); }
  html.gating .gate-slides { margin-top: var(--sp-3); }
}
/* Short windows (a laptop with the bookmarks bar, a phone): tighter spacing so it all fits. */
@media (max-height: 760px) {
  .gate-input, .gate-submit, .gate-signin { height: 44px; }
  .gate-main { padding-top: var(--sp-5); padding-bottom: var(--sp-5); }
  .gate-switch { margin-bottom: var(--sp-4); }
  .gate-or { margin: var(--sp-4) 0 var(--sp-3); }
  .gate-fine { margin-top: var(--sp-4); }
  .gate-alt { margin-top: var(--sp-2); }
}
