@import url("tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; background: var(--bedrock); }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-text); font-size: var(--text-base); line-height: 1.5; color: var(--ink); }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--rod); outline-offset: 2px; }

/* The surface */
.sky { position: relative; background: var(--sky); overflow: clip; }
.sky-home { padding: var(--space-2xl) var(--gutter) 0; }
.wordmark {
  font-family: var(--font-display); font-weight: 900; color: var(--ink);
  font-size: clamp(7rem, 38vw, 15rem); line-height: .84; letter-spacing: -.035em;
  display: flex; flex-direction: column; max-width: 980px; margin: 0 auto;
}
.wordmark span + span { margin-left: .42em; padding-bottom: .14em; }
@media (min-width: 760px) {
  .wordmark { flex-direction: row; gap: .3em; }
  .wordmark span + span { margin-left: 0; padding-bottom: 0; }
  .wordmark { padding-bottom: .12em; }
}
.ground-edge { position: relative; height: 54px; margin: -46px calc(var(--gutter) * -1) 0; z-index: 1; }
.ground-edge svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.home-earth { position: relative; background: var(--soil-0); min-height: 60svh; overflow: clip; }
.home-bg { position: absolute; inset: 0; }
.home-bg svg { position: absolute; left: 0; width: 100%; display: block; }
.home-col { position: relative; max-width: 620px; margin: 0 auto; padding: var(--space-md) var(--gutter) var(--space-2xl); color: var(--on-dark); }
.lede { font-size: var(--text-lg); line-height: 1.45; }
form { margin-top: var(--space-lg); }
label { display: block; font-size: var(--text-sm); margin-bottom: var(--space-2xs); }
.field { display: flex; gap: 0; background: var(--bone); border: 2px solid var(--ink); }
.field input {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; color: var(--ink);
  padding: .8rem .75rem; font-size: var(--text-lg); border-radius: 0; outline-offset: -4px;
}
.field input::placeholder { color: var(--ink-soft); }
.field button {
  flex: none; border: 0; border-left: 2px solid var(--ink); background: var(--rod); color: var(--bone);
  font-family: var(--font-display); font-weight: 900; font-size: var(--text-xl); padding: 0 1.3rem; cursor: pointer;
  transition: background var(--dur-state) var(--ease-out);
}
.field button:hover { background: var(--rod-deep); }
.field button:active { transform: translateY(1px); }
.field button:disabled { background: var(--ink-soft); cursor: progress; }
.status { min-height: 1.5em; margin-top: var(--space-xs); font-size: var(--text-sm); }
.status[data-tone="bad"] { background: var(--bone); color: var(--rod-deep); padding: var(--space-xs); }

.try { margin-top: var(--space-md); font-size: var(--text-sm); background: var(--soil-1); padding: var(--space-xs) var(--space-sm) var(--space-sm); margin-inline: calc(var(--space-sm) * -1); }
.try ul { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-xs); }
.try button {
  background: none; color: inherit; border: 0; border-bottom: 1px solid currentColor; cursor: pointer;
  padding: .5rem 0 .15rem; margin-right: var(--space-sm);
}
.try button:hover { color: var(--card); }

.drill { position: absolute; left: 50%; top: 0; bottom: 0; width: 5px; margin-left: -2px; pointer-events: none; overflow: clip; opacity: 0; }
.drill i { display: block; height: 100%; background: repeating-linear-gradient(var(--rod) 0 26px, var(--bone) 26px 52px); transform-origin: top; transform: scaleY(0); }
[data-state="digging"] .drill { opacity: 1; }
[data-state="digging"] .drill i { transform: scaleY(1); transition: transform 9s var(--ease-out); }

.how { margin-top: 44vh; }
.how h2 { font-family: var(--font-display); font-weight: 900; font-size: var(--text-xl); line-height: 1.15; margin-bottom: var(--space-sm); }
.how p + p { margin-top: var(--space-sm); }
.how { background: var(--bone); color: var(--ink); padding: var(--space-lg) var(--space-md); transform: rotate(-.5deg); }
.credit { margin-top: var(--space-xl); font-size: .78rem; color: var(--on-light); font-weight: 700; }
.close .credit { color: inherit; font-weight: 400; }

/* A dug result */
.site-surface { position: relative; background: var(--sky); min-height: 66svh; display: flex; flex-direction: column; justify-content: flex-end; overflow: clip; }
.survey { position: absolute; top: 0; left: 0; right: 0; padding: var(--space-md) var(--gutter); display: flex; justify-content: space-between; gap: var(--space-md); font-size: var(--text-sm); }
.survey b { font-family: var(--font-display); font-weight: 900; font-size: var(--text-lg); }
.survey a { padding: 2px 0; }
.sign { align-self: center; position: relative; width: min(330px, calc(100vw - 48px)); margin-bottom: -6px; z-index: 2; transform: rotate(-1.4deg); }
.sign-board { background: var(--card); border: 2px solid var(--ink); padding: var(--space-md); text-align: center; position: relative; z-index: 1; }
.sign small { display: block; font-size: var(--text-sm); }
.sign strong { display: block; font-family: var(--font-display); font-weight: 900; font-size: var(--host-size, 1.75rem); line-height: 1.15; overflow-wrap: anywhere; margin: var(--space-2xs) 0; }
.sign::before, .sign::after { content: ""; display: block; position: absolute; width: 12px; top: 40px; height: calc(100% + 30px); background: var(--bronze-deep); }
.sign::before { left: 18%; } .sign::after { right: 18%; }
.sign-leg { height: 96px; }
.scroll-cue { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--space-3xl) var(--gutter) var(--space-lg); text-align: center; font-family: var(--font-display); font-weight: 900; font-size: clamp(2rem, 11vw, 3.25rem); line-height: 1.05; letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.edge { position: relative; height: 40px; margin-top: -36px; z-index: 3; }
.edge svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.trench { position: relative; overflow: clip; }
.rod-staff { position: absolute; z-index: 4; left: 10px; top: 0; bottom: 0; width: var(--rod-w); background: repeating-linear-gradient(var(--rod) 0 110px, var(--bone) 110px 220px); border-inline: 1px solid var(--line-dark); }

.stratum { position: relative; color: var(--on); --here-dark: color-mix(in oklch, var(--here) 82%, var(--ink)); --here-light: color-mix(in oklch, var(--here) 88%, var(--bone)); }
.stratum > svg { position: absolute; left: 0; top: -36px; display: block; pointer-events: none; }
.stratum-in { position: relative; z-index: 2; max-width: 780px; margin: 0 auto; padding: var(--space-xl) var(--gutter) var(--space-lg) calc(var(--rod-w) + 26px); height: 100%; display: flex; flex-direction: column; justify-content: space-evenly; gap: var(--space-xl); }
.circa { font-family: var(--font-display); font-weight: 900; font-size: clamp(3.25rem, 17vw, 5.5rem); line-height: 1; letter-spacing: -.02em; }
.find { display: flex; flex-direction: column; gap: var(--space-sm); max-width: 330px; }
.stratum:nth-child(even) .find { margin-left: auto; align-items: flex-end; }
.find svg.art { width: min(190px, 52vw); height: auto; display: block; overflow: visible; }
.flake { opacity: clamp(0, calc((var(--t) - var(--dug, 0)) * 14), 1); }
.note {
  background: var(--bone); color: var(--ink); padding: var(--space-sm) var(--space-md); border-left: 4px solid var(--rod);
  font-size: var(--text-sm); line-height: 1.4; transform: rotate(var(--tilt, 0deg)); width: 100%;
}
.note small { display: block; font-size: var(--text-sm); color: var(--ink-soft); }
.note h3 { font-family: var(--font-display); font-weight: 900; font-size: var(--text-lg); line-height: 1.2; margin: 2px 0 var(--space-2xs); overflow-wrap: anywhere; }
.note code { display: block; font-family: var(--font-text); margin-top: var(--space-xs); padding-top: var(--space-2xs); border-top: 1px dashed var(--card-edge); overflow-wrap: anywhere; color: var(--ink-soft); }
@media (min-width: 720px) {
  .find { flex-direction: row; max-width: none; align-items: center; gap: var(--space-xl); }
  .stratum:nth-child(even) .find { flex-direction: row-reverse; margin-left: 0; align-items: center; }
  .note { max-width: 380px; }
  .find svg.art { width: 220px; flex: none; }
}

.hud {
  position: fixed; z-index: 9; top: calc(env(safe-area-inset-top) + 10px); right: 10px; background: var(--bone); color: var(--ink);
  border: 2px solid var(--ink); padding: 2px 10px; font-family: var(--font-display); font-weight: 900; font-size: var(--text-xl); line-height: 1.3;
  font-variant-numeric: tabular-nums; opacity: 0; pointer-events: none; transition: opacity var(--dur-state) var(--ease-out);
}
.hud.on { opacity: 1; }

/* Bedrock and the tag */
.bedrock { position: relative; background: var(--bedrock); color: var(--on-dark); }
.bedrock > svg { position: absolute; left: 0; top: -36px; display: block; pointer-events: none; }
.peg { position: absolute; left: 50%; top: 96px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--stone); box-shadow: inset -3px -4px 0 var(--stone-deep), 0 2px 0 var(--line-dark); z-index: 2; }
.tag-note-under { position: absolute; left: var(--gutter); right: var(--gutter); bottom: var(--space-lg); text-align: center; font-size: var(--text-sm); max-width: 420px; margin: 0 auto; }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }
.tag {
  position: fixed; left: 0; top: 0; z-index: 7; width: min(300px, calc(100vw - 56px)); margin-left: calc(min(300px, calc(100vw - 56px)) / -2);
  transform-origin: 50% 20px; filter: drop-shadow(0 8px 10px oklch(10% .01 50 / .5)); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
  will-change: transform; visibility: hidden;
}
.tag.on { visibility: visible; }
.tag:active { cursor: grabbing; }
.tag-card {
  background: var(--card); color: var(--ink); padding: 40px var(--space-md) var(--space-md); text-align: center;
  clip-path: polygon(22% 0, 78% 0, 100% 34px, 100% 100%, 0 100%, 0 34px);
}
.tag-card::before { content: ""; position: absolute; left: 50%; top: 9px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--bedrock); border: 4px solid var(--card-edge); }
.tag-host { font-size: var(--text-sm); overflow-wrap: anywhere; border-bottom: 1px solid var(--ink); padding-bottom: var(--space-2xs); }
.tag-head { margin-top: var(--space-sm); font-size: var(--text-base); font-weight: 700; }
.tag-value { font-family: var(--font-display); font-weight: 900; font-size: clamp(2.5rem, 13vw, 3.25rem); line-height: 1.05; letter-spacing: -.02em; white-space: nowrap; }
.tag-value.words { font-size: 1.85rem; line-height: 1.3; }
.tag-sub { margin-top: var(--space-xs); font-size: var(--text-sm); line-height: 1.35; }

/* After the dig */
.report { position: relative; background: var(--bone); color: var(--ink); padding: var(--space-2xl) var(--gutter); }
.report-col { max-width: 620px; margin: 0 auto; }
.report h2 { font-family: var(--font-display); font-weight: 900; font-size: var(--text-2xl); line-height: 1.1; letter-spacing: -.01em; }
.verdict { margin-top: var(--space-sm); font-size: var(--text-lg); line-height: 1.4; }
.card-img { display: block; width: min(100%, 360px); height: auto; margin-top: var(--space-lg); border: 2px solid var(--ink); }
.acts { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-md); align-items: center; }
.btn {
  display: inline-block; border: 2px solid var(--ink); background: var(--rod); color: var(--bone); text-decoration: none; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); line-height: 1.2; padding: .8rem 1.1rem; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-state) var(--ease-out);
}
.btn:hover { background: var(--rod-deep); }
.btn:active { transform: translateY(1px); }
.btn.plain { background: transparent; color: var(--ink); }
.btn.plain:hover { background: var(--card); }
.notes { margin-top: var(--space-2xl); }
.notes h3 { font-family: var(--font-display); font-weight: 900; font-size: var(--text-lg); margin-bottom: var(--space-xs); }
.notes p + p { margin-top: var(--space-sm); }
.notes .wb { border-left: 4px solid var(--card-edge); padding-left: var(--space-sm); margin-bottom: var(--space-md); min-height: 3em; }

.close { background: var(--soil-0); color: var(--on-dark); padding: var(--space-3xl) var(--gutter) var(--space-xl); }
.close-col { max-width: 620px; margin: 0 auto; }
.close h2 { font-family: var(--font-display); font-weight: 900; font-size: clamp(2.5rem, 12vw, 4rem); line-height: 1.02; letter-spacing: -.02em; }
.close p { margin-top: var(--space-md); font-size: var(--text-lg); line-height: 1.4; }
.close .btn { margin-top: var(--space-lg); border-color: var(--on-dark); white-space: normal; }
.close p.credit { margin-top: var(--space-2xl); font-size: .78rem; }
