/* Duskwell — line-art on a dusk-indigo ground. One accent (lilac), thin rules, no fills.
   Three states: ≤ 720 one column · 720–1000 one wider column · ≥ 1000 the tape and its well head in a primary
   column with the log standing beside it. The windlass is fixed at every width. */
:root {
  --ground: #0F0C18;
  --ink: #EEE8F4;
  --dusk: #C79BFF;
  --rule: rgba(238, 232, 244, .16);
  --rule-soft: rgba(238, 232, 244, .08);
  --hush: rgba(238, 232, 244, .55);
  --hush2: rgba(238, 232, 244, .36);
  --glow: rgba(199, 155, 255, .14);
  --display: 'Poiret One', 'Figtree', sans-serif;
  --body: 'Figtree', system-ui, sans-serif;
  --wind-h: 98px;
  --fathom-h: 46px;
  --gutter: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5;
  padding-top: var(--wind-h); overflow-x: hidden;
  background-image: radial-gradient(ellipse at 50% -10%, rgba(199, 155, 255, .09), transparent 55%);
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.digits { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.hush { color: var(--hush); font-size: 13px; margin: 0; }

/* ---------- the windlass (fixed chrome) ---------- */
#windlass {
  position: fixed; inset: 0 0 auto 0; z-index: 30; height: var(--wind-h);
  display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: 52px 46px; align-items: center;
  column-gap: 10px; padding: 0 var(--gutter); background: rgba(15, 12, 24, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
#windlass::after {
  content: ""; position: absolute; left: var(--gutter); right: var(--gutter); top: 52px; height: 1px; background: var(--rule-soft);
}
.crank { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.crank img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--rule); }
.crank span { font-family: var(--display); font-size: 22px; letter-spacing: .02em; line-height: 1; }
.ropebuy {
  justify-self: center; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 10px;
  border: 1px solid var(--dusk); border-radius: 999px; text-decoration: none; color: var(--dusk); white-space: nowrap;
  box-shadow: 0 0 0 3px var(--glow); max-width: 100%;
}
.ropebuy i { font-style: normal; font-weight: 700; font-size: 12px; letter-spacing: .06em; }
.ropebuy em { font-style: normal; font-size: 12px; color: var(--hush); }
.ropebuy[data-live="1"] em { color: var(--ink); }
.ropebuy[data-live="1"]::after { content: "→"; font-size: 13px; }
.ropebuy:not([href]) { cursor: default; }
/* A fixed bar never shows up as horizontal overflow, so it has to be made to fit by construction: under 560px the
   crank is the mark alone, and the pill may shrink rather than push the connect button off the edge. */
@media (max-width: 559px) {
  .crank span { display: none; }
  .ropebuy { min-width: 0; padding: 0 10px 0 9px; gap: 6px; }
  .ropebuy em { overflow: hidden; text-overflow: ellipsis; }
  .tether { padding: 0 10px; }
}
.tether {
  height: 34px; padding: 0 12px; border: 1px solid var(--rule); background: transparent; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .03em; cursor: pointer; white-space: nowrap;
}
.tether[data-on="1"] { border-color: var(--dusk); color: var(--dusk); }
.rungsnav { grid-column: 1 / -1; display: flex; gap: 4px; align-items: center; height: 46px; overflow-x: auto; scrollbar-width: none; }
.rungsnav::-webkit-scrollbar { display: none; }
.rungsnav a { text-decoration: none; font-size: 13px; color: var(--hush); padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.rungsnav a[aria-current="page"] { color: var(--ink); background: rgba(238, 232, 244, .06); }

/* ---------- the shaft (page grid) ---------- */
#shaft { max-width: 1180px; margin: 0 auto; padding: 18px var(--gutter) 40px; display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 22px; }

/* ---------- the well head ---------- */
.eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--dusk); }
.wellhead h1 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1.02; letter-spacing: .01em; }
.standfirst { margin: 0 0 16px; font-size: 15px; color: var(--hush); max-width: 60ch; }
.gauges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.gauges li { border: 1px solid var(--rule); border-radius: 8px; padding: 9px 11px; }
.gauges b { display: block; font-size: 20px; font-weight: 600; line-height: 1.15; }
.gauges small { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--hush2); margin-top: 2px; }
.ropeform { border: 1px solid var(--rule); border-radius: 12px; padding: 14px; position: relative; background: rgba(15, 12, 24, .5); }
.ropeform::before { content: ""; position: absolute; left: 50%; top: -22px; width: 1px; height: 22px; background: var(--rule); }
.ropeform label { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--hush2); margin-bottom: 6px; }
.ropefield { display: flex; align-items: center; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.ropefield input {
  flex: 1 1 auto; min-width: 0; height: 48px; padding: 0 12px; border: 0; background: transparent; font-size: 24px; font-weight: 600; outline: none;
  -moz-appearance: textfield;
}
.ropefield input::-webkit-outer-spin-button, .ropefield input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ropefield i { font-style: normal; padding: 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--hush); border-left: 1px solid var(--rule); height: 48px; display: inline-flex; align-items: center; white-space: nowrap; }
.readout { margin: 10px 0 12px; font-size: 14px; color: var(--hush); }
.readout b { color: var(--ink); font-weight: 600; }
.lowerbtn {
  width: 100%; height: 50px; border: 1px solid var(--dusk); border-radius: 10px; background: transparent; color: var(--dusk);
  font-size: 15px; font-weight: 700; letter-spacing: .04em; cursor: pointer; transition: background .15s, color .15s;
}
.lowerbtn:hover:not([disabled]) { background: var(--dusk); color: var(--ground); }
.lowerbtn[disabled] { opacity: .45; cursor: not-allowed; }
.shutnote { margin: 10px 0 0; font-size: 13px; color: var(--hush2); }

/* ---------- the plumb tape (the one object) ---------- */
.plumb { position: relative; }
.plumbtitle { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.plumbtitle h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; }
.plumbtitle em { font-style: normal; font-size: 12px; color: var(--hush2); text-align: right; }
.tape {
  position: relative; height: calc(var(--fathom-h) * var(--fathoms, 16) + 34px); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule);
  border-radius: 4px 4px 0 0; overflow: hidden;
  background: linear-gradient(180deg, rgba(15, 12, 24, 0) 0, rgba(199, 155, 255, .04) 100%);
}
.tape::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; border-top: 1px solid var(--rule-soft); }
.fathomrow { position: absolute; left: 0; right: 0; height: var(--fathom-h); border-top: 1px dashed var(--rule-soft); }
.fathomrow > b { position: absolute; left: 8px; top: 3px; font-size: 11px; font-weight: 600; color: var(--hush2); }
.fathomrow > s { position: absolute; right: 8px; top: 3px; font-size: 10px; text-decoration: none; color: var(--hush2); letter-spacing: .04em; }
.dawnband {
  position: absolute; left: 0; right: 0; bottom: 34px;
  background: repeating-linear-gradient(135deg, rgba(199, 155, 255, .10) 0 1px, transparent 1px 10px);
  border-top: 1px solid rgba(199, 155, 255, .4);
}
.dawnband > span { position: absolute; right: 44px; top: 4px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: rgba(199, 155, 255, .7); }
.spillshade { position: absolute; left: 0; right: 0; bottom: 34px; background: rgba(15, 12, 24, .55); }
.nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--dusk); box-shadow: 0 0 12px var(--glow); }
.nowline::before { content: ""; position: absolute; left: -1px; top: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--dusk); }
.nowline > span { position: absolute; right: 8px; top: -18px; font-size: 11px; color: var(--dusk); letter-spacing: .04em; white-space: nowrap; }
.duskline { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--ink); }
.duskline > span { position: absolute; left: 8px; top: 4px; font-size: 11px; color: var(--ink); letter-spacing: .04em; white-space: nowrap; }
.bucket { position: absolute; display: flex; align-items: center; gap: 6px; transform: translateY(-50%); max-width: 32%; }
.bucket svg { flex: 0 0 auto; width: 18px; height: 16px; overflow: visible; }
.bucket .lbl { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.bucket .lbl b { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bucket .lbl u { text-decoration: none; font-size: 10px; color: var(--hush2); white-space: nowrap; }
.bucket[data-fate="spill"] { opacity: .45; }
.bucket[data-fate="spill"] .lbl b { text-decoration: line-through; }
.bucket[data-fate="water"] svg path { stroke: var(--dusk); }
.bucket[data-mine="1"] .lbl b { color: var(--dusk); }
.waterline { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; }
.waterline svg { width: 100%; height: 100%; display: block; }
.tapenote { margin: 10px 0 0; font-size: 13px; color: var(--hush2); }
.tapenote b { color: var(--hush); font-weight: 600; }

/* ---------- the log (second column) ---------- */
.log { display: grid; gap: 14px; align-content: start; }
.logcard { border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.loghead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 13px; border-bottom: 1px solid var(--rule-soft); }
.loghead h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 20px; }
.loghead span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--hush2); }
.logbody { padding: 8px 13px 10px; }
.logline { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--rule-soft); font-size: 13px; }
.logline:last-child { border-bottom: 0; }
.logline > i { font-style: normal; font-weight: 700; text-align: center; font-size: 12px; border: 1px solid var(--rule); border-radius: 6px; padding: 2px 0; color: var(--hush); }
.logline[data-k="lowered"] > i { color: var(--dusk); border-color: rgba(199, 155, 255, .5); }
.logline[data-k="drawn"] > i { color: var(--ink); border-color: var(--ink); }
.logline > em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logline > u { text-decoration: none; font-size: 11px; color: var(--hush2); }
.primerlist { margin: 0; padding: 0 0 0 18px; font-size: 13px; color: var(--hush); }
.primerlist li { margin: 5px 0; }
.primerlist b { color: var(--ink); font-weight: 600; }
.drawrow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--rule-soft); font-size: 13px; }
.drawrow:last-child { border-bottom: 0; }
.drawrow > b { font-weight: 600; }
.drawrow > em { font-style: normal; color: var(--hush); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawrow > u { text-decoration: none; font-weight: 600; }
.drawrow[data-kept="1"] > u { color: var(--hush2); }

/* ---------- inner pages ---------- */
.leaf { max-width: 72ch; }
.leaf h2 { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.05; }
.leaf p { margin: 0 0 12px; color: var(--hush); }
.leaf p b { color: var(--ink); font-weight: 600; }
.tablewrap { overflow-x: auto; margin-top: 14px; }
.welltable { width: 100%; border-collapse: collapse; font-size: 13px; }
.welltable th { text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--hush2); padding: 6px 8px; border-bottom: 1px solid var(--rule); }
.welltable td { padding: 8px; border-bottom: 1px dashed var(--rule-soft); white-space: nowrap; }
.haulbtn { height: 32px; padding: 0 12px; border: 1px solid var(--dusk); border-radius: 8px; background: transparent; color: var(--dusk); font-size: 12px; font-weight: 700; cursor: pointer; }
.haulbtn[disabled] { opacity: .5; cursor: wait; }

/* ---------- the sill (footer) ---------- */
.sill { border-top: 1px solid var(--rule); padding-top: 14px; font-size: 12px; color: var(--hush2); display: grid; gap: 4px; }
.sill code { font-family: 'Figtree', monospace; font-size: 11px; word-break: break-all; color: var(--hush); }
.sill a { color: var(--hush); }

/* ---------- the hatch (modal) ---------- */
#hatch { position: fixed; inset: 0; z-index: 40; background: rgba(15, 12, 24, .78); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.hatchbox { width: 100%; max-width: 520px; background: var(--ground); border: 1px solid var(--rule); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, .5); }
.hatchtop { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--rule-soft); font-family: var(--display); font-size: 22px; }
.hatchshut { width: 34px; height: 34px; border: 1px solid var(--rule); border-radius: 50%; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; }
.hatchbody { padding: 14px 16px 20px; }
.hatchbody p { margin: 0 0 10px; font-size: 14px; color: var(--hush); }
.hatchbody p b { color: var(--ink); font-weight: 600; }
.hatchbody .lowerbtn { margin-top: 6px; }
.walletpick { display: grid; gap: 8px; }
.walletpick button { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 10px; background: transparent; cursor: pointer; font-size: 14px; }
.walletpick img { width: 22px; height: 22px; border-radius: 6px; }
.ripple { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--ground); padding: 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 720–1000: one column, wider measure ---------- */
@media (min-width: 720px) {
  :root { --fathom-h: 52px; --gutter: 28px; }
  body { font-size: 16px; }
  .wellhead h1 { font-size: 54px; }
  .standfirst { font-size: 17px; }
  .gauges { grid-template-columns: repeat(4, 1fr); }
  .gauges b { font-size: 24px; }
  .plumbtitle h2 { font-size: 30px; }
  .bucket .lbl b { font-size: 12px; }
  #hatch { align-items: center; padding: 20px; }
  .hatchbox { border-bottom: 1px solid var(--rule); border-radius: 16px; }
}

/* ---------- ≥ 1000: the page recomposes — well head + tape left, the log standing beside them ---------- */
@media (min-width: 1000px) {
  :root { --wind-h: 64px; --fathom-h: 52px; --gutter: 32px; }
  #windlass { grid-template-columns: auto auto 1fr auto; grid-template-rows: 64px; column-gap: 18px; }
  #windlass::after { display: none; }
  .rungsnav { grid-column: 3; grid-row: 1; justify-self: end; height: auto; }
  .tether { grid-column: 4; grid-row: 1; justify-self: end; }
  .ropebuy { justify-self: start; }
  #shaft {
    grid-template-columns: minmax(0, 1fr) 360px; column-gap: 32px; row-gap: 26px; padding-top: 28px;
    grid-template-areas: "head log" "plumb log" "sill sill";
  }
  .wellhead { grid-area: head; }
  .plumb { grid-area: plumb; }
  .log { grid-area: log; position: sticky; top: calc(var(--wind-h) + 20px); align-self: start; }
  .sill { grid-area: sill; }
  .wellhead { display: grid; grid-template-columns: minmax(0, 1fr) 320px; column-gap: 24px; row-gap: 0; align-items: start; }
  .wellhead .eyebrow, .wellhead h1, .wellhead .standfirst { grid-column: 1; }
  .wellhead .ropeform { grid-column: 2; grid-row: 1 / span 3; }
  .wellhead .gauges { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); margin: 18px 0 0; }
  .wellhead .leaf { grid-column: 1 / -1; }
  .wellhead h1 { font-size: 44px; }
  .standfirst { font-size: 15px; margin-bottom: 0; }
  .gauges b { font-size: 26px; }
  .ropeform::before { display: none; }
  .bucket { max-width: 30%; }
}
@media (min-width: 1240px) {
  #shaft { grid-template-columns: minmax(0, 1fr) 400px; column-gap: 36px; }
  .wellhead { grid-template-columns: minmax(0, 1fr) 340px; column-gap: 28px; }
  .wellhead h1 { font-size: 48px; }
  .standfirst { font-size: 16px; }
}
