/* ABYLAY — the public story page and the signed-in workspace.
 *
 * Loaded after theme.css, so it inherits the token list and nothing here
 * hardcodes a colour. Every value goes through a token; that is what makes
 * dark mode a remap rather than a second stylesheet. If you add a colour and
 * dark mode grows a light patch, you hardcoded a hex.
 *
 * Two surfaces live here:
 *   1. #view-home  — what a visitor sees signed out. Description, not product.
 *   2. #view-panel — the workspace, reachable only signed in.
 */

/* ========================================================================
   1. THE PUBLIC PAGE
   ======================================================================== */

.home-hero {
  position: relative;
  padding: clamp(56px, 9vw, 116px) 0 clamp(48px, 7vw, 92px);
  overflow: hidden;
}
.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 5vw, 76px);
  align-items: center;
}
.home-eyebrow {
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--line-strong);
}
.home-hero h1 {
  font: 600 clamp(38px, 5.6vw, 72px)/1.03 var(--display);
  letter-spacing: -0.022em;
  margin: 20px 0 0;
  text-wrap: balance;
  color: var(--ink);
}
.home-hero h1 em {
  font-style: normal;
  color: var(--violet);
}
.home-lede {
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 22px 0 0;
  max-width: 54ch;
  text-wrap: pretty;
}
.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
  align-items: center;
}
.home-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
}

/* --- The isometric plate. The logo's own geometry, at figure scale. ----- */
.plate-figure {
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  display: block;
  overflow: visible;
}
.plate-face { fill: var(--surface2); stroke: var(--line-strong); stroke-width: 0.5; }
.plate-side-l { fill: var(--violet-deep); opacity: 0.55; }
.plate-side-r { fill: var(--violet); opacity: 0.32; }
.plate-well { fill: var(--ink); opacity: 0.86; }
.plate-well-live { fill: var(--violet); opacity: 1; }
.plate-ring { fill: none; stroke: var(--violet-line); stroke-width: 0.6; opacity: 0.7; }

/* The wells breathe in sequence, slowly. A figure, not a loader: long cycle,
   low amplitude, and it stops entirely for reduced-motion. */
.plate-well { animation: wellPulse 5.2s ease-in-out infinite; transform-origin: center; }
.plate-well:nth-of-type(2) { animation-delay: 0.25s; }
.plate-well:nth-of-type(3) { animation-delay: 0.5s; }
.plate-well:nth-of-type(4) { animation-delay: 0.75s; }
.plate-well:nth-of-type(5) { animation-delay: 1s; }
.plate-well:nth-of-type(6) { animation-delay: 1.25s; }
.plate-well:nth-of-type(7) { animation-delay: 1.5s; }
.plate-well:nth-of-type(8) { animation-delay: 1.75s; }
@keyframes wellPulse {
  0%, 100% { opacity: 0.86; }
  50% { opacity: 0.4; }
}

/* --- Section furniture ------------------------------------------------- */
.home-section { padding: clamp(52px, 7vw, 104px) 0; }
.home-section + .home-section { border-top: 1px solid var(--line); }
.home-head { max-width: 60ch; }
.home-head h2 {
  font: 600 clamp(27px, 3.4vw, 42px)/1.12 var(--display);
  letter-spacing: -0.017em;
  margin: 16px 0 0;
  text-wrap: balance;
  color: var(--ink);
}
.home-head p {
  font-size: clamp(15px, 1.3vw, 17px);
  line-height: 1.62;
  color: var(--ink-soft);
  margin: 14px 0 0;
  text-wrap: pretty;
}

/* --- The loop: eight stages, the eight wells of the mark ---------------- */
.loop-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
  margin-top: 44px;
}
.loop-figure { width: 100%; max-width: 460px; margin-inline: auto; display: block; overflow: visible; }
.loop-orbit { fill: none; stroke: var(--line-strong); stroke-width: 0.8; }
.loop-node { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.1; transition: fill 0.2s, stroke 0.2s; }
.loop-node-dot { fill: var(--muted); transition: fill 0.2s; }
.loop-label { font: 500 8.4px/1 var(--sans); fill: var(--ink-soft); letter-spacing: 0.01em; }
.loop-hub { fill: var(--violet); }
.loop-hub-ring { fill: none; stroke: var(--violet-line); stroke-width: 0.9; }

.loop-stage.is-on .loop-node { fill: var(--violet); stroke: var(--violet); }
.loop-stage.is-on .loop-node-dot { fill: var(--violet-ink); }
.loop-stage.is-on .loop-label { fill: var(--ink); font-weight: 650; }

.loop-list { display: flex; flex-direction: column; gap: 2px; }
.loop-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 13px 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: default;
  transition: background 0.16s, border-color 0.16s;
}
.loop-item:hover, .loop-item.is-on {
  background: var(--surface2);
  border-color: var(--line);
}
.loop-item .n {
  font: 600 10px/1 var(--mono);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.loop-item.is-on .n { color: var(--violet); }
.loop-item strong { font-size: 14px; font-weight: 650; color: var(--ink); display: block; }
.loop-item span { font-size: 13px; line-height: 1.5; color: var(--muted); display: block; margin-top: 3px; }

/* --- Principles: what the product refuses to do ------------------------- */
.principle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 1px;
  margin-top: 42px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  overflow: hidden;
}
.principle {
  background: var(--surface);
  padding: 26px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.principle-mark { width: 30px; height: 30px; display: block; color: var(--violet); }
.principle h3 { font: 650 15px/1.3 var(--sans); margin: 0; color: var(--ink); }
.principle p { font-size: 13.5px; line-height: 1.58; color: var(--muted); margin: 0; }
.principle strong {
  font: 600 10.5px/1.4 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: auto;
  padding-top: 8px;
}

/* --- Closing call ------------------------------------------------------- */
.home-cta {
  background: var(--inverse-bg);
  color: var(--inverse-ink);
  border-radius: var(--r3);
  padding: clamp(36px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  margin: clamp(48px, 6vw, 84px) 0;
}
.home-cta h2 {
  font: 600 clamp(24px, 3vw, 36px)/1.14 var(--display);
  letter-spacing: -0.016em;
  margin: 0;
  color: var(--inverse-ink);
  text-wrap: balance;
}
.home-cta p {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--inverse-ink);
  opacity: 0.74;
  max-width: 52ch;
}

/* The panel sets color: var(--inverse-ink), which a .btn inside inherits as its
   TEXT colour while base.css keeps giving it a light background — white on
   white, invisible in light mode. Same shape of trap as --violet-ink in
   theme.css §7: state both ends explicitly rather than inheriting one of them. */
.home-cta .btn {
  background: var(--inverse-ink);
  color: var(--inverse-bg);
  border-color: transparent;
  font-weight: 650;
}
.home-cta .btn:hover { opacity: 0.88; }

/* ========================================================================
   2. THE WORKSPACE
   ======================================================================== */

.panel-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  padding: 32px 0 72px;
  align-items: start;
}
.panel-rail {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.panel-rail a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.panel-rail a:hover { background: var(--surface2); color: var(--ink); }
.panel-rail a.active {
  background: var(--surface2);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 650;
}
.panel-rail .tally {
  font: 600 10.5px/1 var(--mono);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 3px 7px;
}
.panel-rail a.active .tally { color: var(--violet); border-color: var(--violet-line); }
.panel-rail-sep {
  height: 1px;
  background: var(--line);
  margin: 12px 4px;
}

.ws-head { margin-bottom: 26px; }
.ws-head h1 {
  font: 600 clamp(24px, 2.8vw, 34px)/1.14 var(--display);
  letter-spacing: -0.015em;
  margin: 8px 0 0;
  color: var(--ink);
}
.ws-head p { font-size: 14px; line-height: 1.55; color: var(--muted); margin: 9px 0 0; max-width: 62ch; }

/* --- Overview tiles ----------------------------------------------------- */
.tile-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card); }
.tile-label {
  font: 600 10px/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.tile-value {
  font: 600 clamp(22px, 2.4vw, 29px)/1.05 var(--display);
  color: var(--ink);
  letter-spacing: -0.012em;
}
/* An unknown figure must never look like a number. */
.tile-value.is-unknown { color: var(--muted); font-family: var(--sans); font-size: 17px; font-weight: 500; }
.tile-foot { font-size: 12.5px; line-height: 1.45; color: var(--muted); margin-top: auto; padding-top: 6px; }

/* --- Cart --------------------------------------------------------------- */
.cart-table { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; }
.cart-row {
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 132px 108px 36px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
}
.cart-row.head {
  background: var(--surface2);
  font: 600 10px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cart-name { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.cart-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cart-qty {
  width: 100%;
  font: 500 13px/1 var(--sans);
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
}
.cart-qty:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cart-price { font: 500 13px/1.35 var(--sans); color: var(--ink); }
/* "Price unavailable" is a fact about the record, so it reads as text, never
   as a zero or a dash that could pass for a number. */
.cart-price.is-missing { color: var(--muted); font-size: 12.5px; }
.cart-line { font: 600 14px/1 var(--mono); color: var(--ink); text-align: right; }
.cart-line.is-missing { font: 500 12px/1.3 var(--sans); color: var(--muted); text-align: right; }
.cart-drop {
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  border-radius: var(--r);
  width: 30px; height: 30px;
  font-size: 17px; line-height: 1;
  cursor: pointer;
}
.cart-drop:hover { color: var(--ink); border-color: var(--line-strong); }

.cart-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-top: 18px;
  padding: 18px 20px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r2);
}
.cart-total-figure { font: 600 clamp(24px, 3vw, 32px)/1 var(--display); color: var(--ink); letter-spacing: -0.014em; }
.cart-total-note { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 6px; max-width: 46ch; }
.cart-warn {
  font: 500 12.5px/1.5 var(--sans);
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 9px 12px;
  margin-top: 12px;
}

/* --- Empty states ------------------------------------------------------- */
.panel-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r2);
  padding: 40px 28px;
  text-align: center;
  color: var(--muted);
}
.panel-empty h3 { font: 650 15px/1.35 var(--sans); color: var(--ink); margin: 0 0 7px; }
.panel-empty p { font-size: 13.5px; line-height: 1.55; margin: 0 auto; max-width: 44ch; }
.panel-empty .actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* --- The gate a signed-out visitor meets -------------------------------- */
.gate {
  max-width: 520px;
  margin: clamp(48px, 8vw, 100px) auto;
  text-align: center;
}
.gate-mark { width: 54px; height: 54px; margin: 0 auto 22px; display: block; color: var(--violet); }
.gate h2 { font: 600 clamp(24px, 3vw, 32px)/1.14 var(--display); margin: 0; color: var(--ink); text-wrap: balance; }
.gate p { font-size: 15px; line-height: 1.6; color: var(--muted); margin: 14px 0 0; }
.gate .actions { margin-top: 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ========================================================================
   3. NARROW SCREENS
   ======================================================================== */

@media (max-width: 900px) {
  .home-hero-grid, .loop-wrap { grid-template-columns: minmax(0, 1fr); }
  .home-hero-grid .plate-figure { max-width: 380px; order: -1; }
  .home-cta { grid-template-columns: minmax(0, 1fr); }
  .panel-shell { grid-template-columns: minmax(0, 1fr); }
  .panel-rail {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
  }
  .panel-rail a { white-space: nowrap; }
  .panel-rail-sep { display: none; }
}

@media (max-width: 640px) {
  /* The cart becomes stacked cards: a five-column grid at phone width is what
     produces a horizontal scrollbar on the whole page. */
  .cart-row.head { display: none; }
  .cart-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name drop" "qty price" "line line";
    gap: 10px 12px;
  }
  .cart-row > :nth-child(1) { grid-area: name; }
  .cart-row > :nth-child(2) { grid-area: qty; }
  .cart-row > :nth-child(3) { grid-area: price; }
  .cart-row > :nth-child(4) { grid-area: line; text-align: left; }
  .cart-row > :nth-child(5) { grid-area: drop; }
  .cart-qty { max-width: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .plate-well { animation: none; opacity: 0.86; }
}
