/* ============================================================
   adhd-study-pack.css — standalone styles for the study pack app.

   Self-contained rather than built on style.css: the app is a tool,
   not a page of the portfolio, and it wants a calmer, lower-contrast
   surface than the marketing pages. Design choices are deliberate for
   the audience — restrained motion, one clear focal point per view,
   and nothing that moves unless the reader started it.
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e6ec;
  --text: #16202e;
  --text-2: #4a5668;
  --muted: #7b8698;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, .1);
  --accent-ink: #ffffff;
  --good: #0f9d58;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1520;
    --surface: #161e2c;
    --surface-2: #1c2636;
    --border: #29344a;
    --text: #e7ecf4;
    --text-2: #b3bece;
    --muted: #8794a8;
    --accent: #818cf8;
    --accent-soft: rgba(129, 140, 248, .16);
    --accent-ink: #0f1520;
    --good: #4ade80;
    --warn: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

/* An author rule with an explicit `display` outranks the UA's [hidden] rule —
   same specificity, and the author sheet comes later. Several elements here
   are toggled with .hidden and are styled as flex, so state this once rather
   than rediscovering it per component. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

:where(button, input, [href], summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------- nav */

.pack-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.pack-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.01em;
}

.pack-mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  font-size: 14px;
}

.pack-nav nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: .88rem;
}

.pack-nav nav a {
  color: var(--text-2);
  text-decoration: none;
}

.pack-nav nav a:hover { color: var(--accent); }

.pack-profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: .82rem;
}

.pack-signout {
  padding: 5px 12px;
  font: inherit;
  font-size: .8rem;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
}

.pack-signout:hover { color: var(--text); }

.pack-shell {
  width: min(100% - 32px, 1080px);
  margin-inline: auto;
  padding-block: clamp(28px, 5vw, 56px) 72px;
}

/* ------------------------------------------------------- sign in */

.auth {
  max-width: 620px;
  margin-inline: auto;
}

.auth h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  letter-spacing: -.02em;
}

.auth-lead {
  margin: 0 0 28px;
  color: var(--text-2);
  text-wrap: pretty;
}

.auth-form {
  display: grid;
  gap: 8px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-form label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
}

.auth-form input {
  padding: 11px 13px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.auth-submit {
  margin-top: 4px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: 9px;
  cursor: pointer;
}

.profile-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.profile-list-label {
  width: 100%;
  margin: 0;
  font-size: .78rem;
  color: var(--muted);
}

.profile-chip {
  padding: 6px 14px;
  font: inherit;
  font-size: .84rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 18px;
  cursor: pointer;
}

.profile-chip:hover { border-color: var(--accent); }

.auth-note,
.auth-future {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-note p,
.auth-future-note {
  margin: 0;
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}

.auth-google {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 9px 18px;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: not-allowed;
}

.auth-google span {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  background: var(--surface-2);
  border-radius: 50%;
  font-weight: 700;
}

.auth-google:not(:disabled) {
  color: var(--text);
  cursor: pointer;
}

.auth-google:not(:disabled):hover { border-color: var(--accent); }

.auth-google:not(:disabled) span {
  color: var(--accent-ink);
  background: var(--accent);
}

.auth-phone {
  display: grid;
  gap: 6px;
  margin: 4px 0 12px;
}

.auth-phone label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
}

.auth-phone .panel-form { margin-bottom: 0; }

.auth-phone .btn-ghost {
  justify-self: start;
  padding: 5px 12px;
  font-size: .8rem;
}

.auth-future-note { font-size: .8rem; }

.auth-future-note.is-error { color: #b42318; }

@media (prefers-color-scheme: dark) {
  .auth-future-note.is-error { color: #f97066; }
}

.pack-profile[data-backend="cloud"] .pack-profile-name::after {
  content: " · synced";
  color: var(--accent);
}

/* ---------------------------------------------------------- app */

.pack-top {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.now-card,
.timer-card,
.panel {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 14px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- the one thing you are doing ---- */

.now-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 190px;
  border-left: 4px solid var(--accent);
}

.now-label {
  margin: 0 0 6px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}

.now-title {
  margin: 0 0 14px;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  line-height: 1.3;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.now-step {
  margin: 0;
  color: var(--text-2);
  font-size: .95rem;
}

.now-step-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 9px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 12%, transparent);
  border-radius: 12px;
}

.now-step--none,
.now-empty { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---- timer ---- */

.timer-card {
  position: relative;
  overflow: hidden;
  text-align: center;
}

/* A quiet fill along the bottom edge. Progress you can glance at without
   it competing with the task itself for attention. */
.timer-card::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: calc(var(--progress, 0) * 100%);
  background: var(--accent);
  transition: width .3s linear;
}

.timer-card.is-complete {
  border-color: var(--good);
}

.timer-clock {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 6vw, 3.1rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  line-height: 1;
}

.timer-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.timer-range-row input { flex: 1; accent-color: var(--accent); }

.timer-range-label {
  min-width: 58px;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.timer-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.timer-hint {
  margin: 14px 0 0;
  font-size: .78rem;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---- buttons ---- */

.btn-primary,
.btn-secondary,
.btn-ghost {
  padding: 9px 18px;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary { color: var(--accent-ink); background: var(--accent); }
.btn-secondary { color: var(--accent); background: var(--accent-soft); }
.btn-ghost { color: var(--text-2); background: transparent; border-color: var(--border); }
.btn-ghost:hover { color: var(--text); }

/* ---- panels ---- */

.pack-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.panel-hint {
  margin: -6px 0 14px;
  font-size: .76rem;
  color: var(--muted);
}

kbd {
  padding: 1px 5px;
  font: inherit;
  font-size: .72rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* ---- tasks ---- */

.task-list { margin: 0; padding: 0; list-style: none; }

.task-row {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.task-row:first-child { border-top: none; }

.task-row.is-active {
  margin-inline: -12px;
  padding-inline: 12px;
  background: var(--accent-soft);
  border-radius: 10px;
  border-top-color: transparent;
}

.task-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-check { width: 17px; height: 17px; accent-color: var(--accent); flex: 0 0 auto; }

.task-title {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.task-row.is-done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-focus,
.task-remove,
.parked-promote,
.parked-drop,
.step-add {
  padding: 4px 11px;
  font: inherit;
  font-size: .76rem;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  flex: 0 0 auto;
}

.task-focus:hover,
.parked-promote:hover,
.step-add:hover { color: var(--accent); border-color: var(--accent); }

.task-remove,
.parked-drop {
  width: 26px;
  padding: 4px 0;
  font-size: .95rem;
  line-height: 1;
}

.task-remove:hover,
.parked-drop:hover { color: #dc2626; border-color: #dc2626; }

.task-details { margin: 8px 0 0 27px; }

.task-details summary {
  font-size: .78rem;
  color: var(--muted);
  cursor: pointer;
}

.step-list {
  margin: 10px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.step-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .88rem;
}

.step-list li.is-done label { color: var(--muted); text-decoration: line-through; }
.step-list input { accent-color: var(--accent); }
.step-list label { cursor: pointer; overflow-wrap: anywhere; }

.step-form { display: flex; gap: 7px; }

.step-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 11px;
  font: inherit;
  font-size: .84rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.done-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.done-wrap summary {
  font-size: .8rem;
  color: var(--muted);
  cursor: pointer;
}

.done-count { font-variant-numeric: tabular-nums; }

.empty-note {
  padding: 18px 0;
  color: var(--muted);
  font-size: .88rem;
  text-wrap: pretty;
}

/* ---- parked ---- */

.parked-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }

.parked-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: .87rem;
}

.parked-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---- stats ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.stat {
  padding: 16px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat b {
  display: block;
  font-size: 1.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat span {
  font-size: .74rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.noscript-note {
  max-width: 560px;
  margin: 40px auto;
  padding: 18px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------------------------------------------------- responsive */

@media (max-width: 860px) {
  .pack-top,
  .pack-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .pack-nav { padding-inline: 16px; }
  .pack-profile { padding-left: 0; border-left: none; }
  /* The sign-out control is what matters on a narrow screen; the label is not. */
  .pack-profile-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .timer-card::after { transition: none; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .now-card, .timer-card, .panel, .stat, .parked-row { border: 1px solid CanvasText; }
  .task-row.is-active { background: Highlight; color: HighlightText; }
}
