/* MAP.DIAMONDS: placement only. Colour, type, tracking, hairlines and motion
   come from the shell tokens. Black ground, white lines. */

html, body { height: auto; min-height: 100%; }
body.is-intro { overflow: hidden; }

/* ---- Intro: one screen that says what this is, then leaves. ---- */
.intro {
  position: fixed;
  inset: 0;
  z-index: var(--z-top);
  display: grid;
  place-items: center;
  background: var(--g);
  transition: opacity var(--dur-page) var(--ease);
}
.intro.is-done { opacity: 0; pointer-events: none; }
.intro-copy {
  width: 100%;
  max-width: var(--read-w);
  padding: 0 var(--rail);
  display: grid;
  gap: var(--space-md);
}
.intro-name {
  margin: 0 0 var(--space-md);
  font-size: var(--t-label);
  font-weight: var(--w-medium);
  letter-spacing: var(--track-wide);
  color: var(--ink);
}
.intro-line {
  margin: 0;
  font-size: var(--t-body);
  line-height: var(--lh-prose);
  color: var(--ink);
}
.intro-line--quiet { color: var(--ink-3); }
.intro-rule {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--space-4xl) * 2 + env(safe-area-inset-bottom, 0px));
  height: 1px;
  background: var(--line);
}
.intro-rule i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  animation: introRule var(--intro-ms, 2400ms) linear forwards;
}
@keyframes introRule { to { width: 100%; } }
.intro-skip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
  margin: 0 auto;
  min-height: var(--hit);
  padding: 0 var(--space-lg);
  background: transparent;
  border: 0;
  font-size: var(--t-caption);
  letter-spacing: var(--track-caps);
  color: var(--ink-3);
}
.intro-skip:hover, .intro-skip:focus-visible { color: var(--ink); outline: none; }
@media (prefers-reduced-motion: reduce) {
  .intro { transition: none; }
  .intro-rule i { animation: none; width: 100%; }
}

/* ---- The frame: head, panes, tabs. One DOM, two placements. The frame is
   the viewport; the map fills the middle row edge to edge, and the 1/1
   scrolls inside it. ---- */
.frame {
  height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "head" "panes" "tabs";
}
.head {
  grid-area: head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: var(--bar-h);
  padding: 0 var(--rail);
  border-bottom: 1px solid var(--line);
}
.head-name {
  font-size: var(--t-small);
  font-weight: var(--w-medium);
  letter-spacing: 0;
  color: var(--ink);
}
.head-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.head-view[hidden] { display: none; }
.mode-menu { z-index: var(--z-bar); }
body.is-menu-open { overflow: hidden; }
.menu-list {
  display: grid;
  align-content: start;
  justify-items: start;
  padding: var(--space-xl) var(--rail);
}
.menu-list .head-name {
  display: flex;
  align-items: center;
  min-height: var(--hit);
}

/* Tabs: five cells at the foot on a phone. */
.tabs {
  grid-area: tabs;
  z-index: var(--z-bar);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--g);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--hit);
  padding: var(--space-sm) var(--space-xs);
  font-size: var(--t-eyebrow);
  font-weight: var(--w-medium);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
}
/* The glyph: a Codicon seated by the shell, or the diamond key on 1/1.
   The host sets the seat. The key is a mask so it takes currentColor. */
.tab .rs-icon, .tab .diamond-key { font-size: var(--t-title); }
.diamond-key {
  display: block;
  width: 1em;
  height: 1em;
  flex: none;
  background: currentColor;
  -webkit-mask: url("/diamond.svg") center / contain no-repeat;
  mask: url("/diamond.svg") center / contain no-repeat;
}
.diamond-key--plate {
  width: var(--wx-glyph);
  height: var(--wx-glyph);
  color: var(--ink);
}
.tab:hover, .tab:focus-visible { color: var(--ink-2); outline: none; }
.tab[aria-selected="true"] { color: var(--ink); }
/* The lit segment: one white hairline on the bar's edge. */
.tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transition: transform var(--dur-base) var(--ease);
}
.tab[aria-selected="true"]::after { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .tab::after, .tab { transition: none; } }

/* Panes */
.panes { grid-area: panes; min-width: 0; min-height: 0; overflow: auto; }
.pane[hidden] { display: none; }
.pane:not([hidden]) {
  display: grid;
  gap: var(--space-xl);
  padding: var(--space-xl) var(--rail) var(--space-3xl);
}
/* A directory pane is the map, or the list, edge to edge: no padding, no box.
   The map / list switch lives in the head. */
.pane--map:not([hidden]) { display: block; padding: 0; height: 100%; }
.pane--map[data-view="list"] .map { display: none; }
.pane--map[data-view="map"] .list { display: none; }
.list { height: 100%; overflow: auto; padding: var(--space-xl) var(--rail) var(--space-3xl); }
.list-empty { margin: 0; color: var(--ink-3); }
/* The map: white lines on the ground. Strokes stay one pixel at every zoom. */
.map, .map-stage { height: 100%; min-width: 0; }
.map-svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  outline: none;
  fill: none;
  stroke: var(--ink);
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}
.map-stage.is-drawn .map-svg { opacity: 1; }
.map-svg.is-held { cursor: grabbing; }
.map-svg:focus-visible { outline: 1px solid var(--line-strong); outline-offset: -1px; }
.map-svg path {
  vector-effect: non-scaling-stroke;
  stroke: var(--ink);
  stroke-width: 1;
  transition: stroke var(--dur-base) var(--ease);
}
.map-svg[data-zoom="far"] path { stroke: var(--ink-3); }
.map-svg[data-zoom="mid"] path { stroke: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .map-svg, .map-svg path { transition: none; } }

.diamond-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
}
.diamond-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  outline: none;
}
.diamond-canvas.is-held { cursor: grabbing; }
.diamond-canvas:focus-visible { outline: 1px solid var(--line-strong); outline-offset: -1px; }
.ph-label {
  position: absolute;
  font-size: var(--t-caption);
  letter-spacing: var(--track-eyebrow);
  color: var(--ink-3);
}
/* Home: the name, one line, the curl bar, the pitch. One column, centred in
   the row, the reading measure wide. */
.pane--home:not([hidden]) {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100%;
}
.home {
  width: 100%;
  max-width: var(--read-w);
  display: grid;
  gap: var(--space-xl);
}
.home-name { margin: 0; }
.home-line { margin: 0; line-height: var(--lh-prose); color: var(--ink); }
.home .btn--curl { margin-inline: 0; }
.home-for { margin: var(--space-lg) 0 0; }
.home-pitch { margin: 0; line-height: var(--lh-prose); color: var(--ink-2); }

/* The diamond: a product page. Stone facts, token facts, one control. */
.product { display: grid; gap: var(--space-xl); align-content: start; }
.product-title { margin: 0; }
.product-line { margin: 0; line-height: var(--lh-prose); color: var(--ink-2); }
.facts-label {
  margin: 0;
  font-size: var(--t-small);
  letter-spacing: var(--track-label);
  color: var(--ink-3);
}
.facts { margin: 0; border-top: 1px solid var(--line); }
.fact {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--line);
}
.fact dt {
  font-size: var(--t-small);
  letter-spacing: var(--track-label);
  color: var(--ink-3);
}
.fact dd {
  margin: 0;
  font-size: var(--t-small);
  letter-spacing: var(--track-micro);
  color: var(--ink-2);
}
.product .btn { margin-inline: 0; }

/* ---- Wide: tabs join the head row, panes split into two columns. ---- */
@media (min-width: 760px) {
  .frame {
    grid-template-columns: auto 1fr;
    grid-template-areas: "head tabs" "panes panes";
  }
  .tabs {
    display: flex;
    justify-content: flex-end;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 var(--rail) 0 0;
  }
  .tab { flex-direction: row; gap: var(--space-sm); min-height: var(--bar-h); padding: 0 var(--space-lg); }
  .tab .rs-icon, .tab .diamond-key { font-size: var(--t-head); }
  .tab::after { top: auto; bottom: -1px; }
  .pane--diamond:not([hidden]) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-3xl);
    padding-top: var(--space-3xl);
  }
}
