/* SOLERA — chalk on blackened oak. one accent. no weight. */

:root {
  --black: #141009;
  --oak: #33261A;
  --oak-2: #3f2f20;
  --amber: #C9772B;
  --chalk: #EDE4D2;
  --dust: #7A6E5C;

  --serif: 'EB Garamond', 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* everything scales with viewport height so the wall never scrolls */
  --fs: clamp(11.5px, 1.75vh, 17px);
  --fs-s: clamp(10px, 1.35vh, 13px);
  --fs-l: clamp(15px, 2.4vh, 24px);
  --fs-xl: clamp(24px, 4.2vh, 44px);
  --gap: clamp(10px, 1.6vw, 28px);
  --pad: clamp(10px, 1.6vh, 20px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { background: var(--black); }
body {
  font-family: var(--serif);
  font-size: var(--fs);
  line-height: 1.45;
  color: var(--chalk);
  background:
    radial-gradient(ellipse 34vw 46vh at 44% 52%, rgba(201,119,43,.055), transparent 70%),
    var(--black);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
i, em { font-style: italic; }
b, strong { font-weight: inherit; }
.mono { font-family: var(--mono); font-weight: 400; letter-spacing: -0.01em; }
.dust { color: var(--dust); }
.amber { color: var(--amber); }
.s { font-size: var(--fs-s); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .15em; }
.defs { position: absolute; width: 0; height: 0; }

/* chalk grain over the whole wall */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  filter: url(#chalk-noise); opacity: .045; mix-blend-mode: screen;
}
.grain::before { content: ""; position: absolute; inset: 0; background: #000; }

/* ---------- the wall grid ---------- */
.wall {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0 clamp(14px, 2.4vw, 44px);
  gap: var(--pad);
}
.main {
  display: grid;
  grid-template-columns: 31fr 27fr 42fr;
  gap: var(--gap);
  min-height: 0;
}
.main > section { min-height: 0; min-width: 0; display: flex; flex-direction: column; }

/* ---------- header ---------- */
.head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--gap);
  padding-top: clamp(10px, 1.8vh, 22px);
  border-bottom: 1px solid var(--oak);
  padding-bottom: clamp(6px, 1.1vh, 14px);
}
.head-l, .head-r { display: flex; align-items: baseline; gap: clamp(10px, 1.4vw, 26px); min-width: 0; }
.wordmark {
  font-size: var(--fs-xl); letter-spacing: .22em; line-height: 1;
  font-weight: 400;
}
.ticker { font-size: var(--fs-s); color: var(--chalk); display: inline-flex; align-items: baseline; gap: .5em; }
.copy { color: var(--dust); font-size: 1.05em; line-height: 1; }
.copy:hover { color: var(--chalk); }
.copied { font-size: var(--fs-s); color: var(--dust); opacity: 0; transition: opacity .3s; }
.copied.show { opacity: 1; }
.btn {
  font-family: var(--serif); font-size: var(--fs);
  color: var(--chalk); border: 1px solid var(--oak-2); border-radius: 2px;
  padding: .3em 1em; line-height: 1.3;
  transition: border-color .25s, color .25s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--chalk); }
.btn:disabled { color: var(--dust); cursor: default; }
.btn.ghost { color: var(--dust); }
.btn.ghost:hover:not(:disabled) { color: var(--chalk); }

/* ---------- section titles ---------- */
.h {
  margin: 0 0 clamp(4px, .8vh, 10px);
  font-weight: 400; font-style: italic;
  font-size: var(--fs-l); color: var(--dust);
  letter-spacing: .02em;
}

/* ---------- cask ---------- */
.cask-svg { flex: 1; min-height: 0; display: flex; }
.cask-svg svg { width: 100%; height: 100%; }
.cask .stroke { fill: none; stroke: var(--chalk); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; opacity: .92; }
.cask .stave { fill: none; stroke: var(--chalk); stroke-width: .8; opacity: .28; }
.cask .hoop { fill: none; stroke: var(--chalk); stroke-width: 3; opacity: .55; }
.cask .fill-oak { fill: var(--oak-2); transition: height 1.6s cubic-bezier(.3,0,.2,1), y 1.6s cubic-bezier(.3,0,.2,1); }
.cask .fill-amber { fill: var(--amber); opacity: .92; transition: height 1.6s cubic-bezier(.3,0,.2,1), y 1.6s cubic-bezier(.3,0,.2,1); }
.cask .dash { fill: none; stroke: var(--chalk); stroke-width: 1.2; stroke-dasharray: 3 5; opacity: .6; stroke-linecap: round; }
.cask .arrow { fill: none; stroke: var(--chalk); stroke-width: 1.2; opacity: .6; stroke-linecap: round; stroke-linejoin: round; }
.cask .tname { font-family: var(--serif); font-style: italic; font-size: 17px; fill: var(--chalk); }
.cask .tamt { font-family: var(--mono); font-size: 14.5px; fill: var(--chalk); }
.cask .tamt.amber { fill: var(--amber); }
.cask .tsub { font-family: var(--mono); font-size: 10px; fill: var(--dust); }
.cask .flow { font-family: var(--serif); font-style: italic; font-size: 13px; fill: var(--dust); }
.cask .flowm { font-family: var(--mono); font-size: 10.5px; fill: var(--dust); }

/* ---------- candle + pour block ---------- */
.pour {
  display: grid !important;
  grid-template-columns: minmax(80px, 38%) 1fr;
  gap: var(--gap);
  align-items: stretch;
  padding-top: clamp(4px, 1vh, 12px);
}
.candle-col { display: flex; flex-direction: column; min-height: 0; }
.candle-svg { flex: 1; min-height: 0; display: flex; }
.candle-svg svg { width: 100%; height: 100%; }
.caption { margin: .4em 0 0; font-style: italic; font-family: var(--serif); font-size: var(--fs-s); text-align: center; }
.candle .wax { fill: var(--chalk); transition: height 1.4s cubic-bezier(.35,0,.15,1), y 1.4s cubic-bezier(.35,0,.15,1); }
.candle .wax-shade { fill: var(--black); opacity: .13; transition: height 1.4s cubic-bezier(.35,0,.15,1), y 1.4s cubic-bezier(.35,0,.15,1); }
.candle .drip { fill: var(--chalk); opacity: .8; }
.candle .wick { stroke: var(--oak-2); stroke-width: 2; stroke-linecap: round; }
.candle .flame { fill: var(--amber); filter: url(#flame-glow); }
.candle .flame-core { fill: var(--chalk); opacity: .75; }
.candle .dish { fill: none; stroke: var(--chalk); stroke-width: 1.3; opacity: .85; }
.candle .smoke { fill: none; stroke: var(--dust); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0; }
.candle.out .flame, .candle.out .flame-core { opacity: 0; }
.candle.out .smoke { opacity: .8; animation: rise 3s ease-out forwards; }
@keyframes rise { from { transform: translateY(0); opacity: .8 } to { transform: translateY(-18px); opacity: 0 } }

.pour-col { display: flex; flex-direction: column; justify-content: center; gap: clamp(6px, 1.6vh, 20px); min-width: 0; }
.stat { display: grid; gap: .1em; }
.stat .k { font-style: italic; color: var(--dust); font-size: var(--fs); }
.stat .v { font-size: var(--fs-l); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.flash { animation: flash 3s ease-out; }
@keyframes flash { 0% { text-shadow: 0 0 14px rgba(201,119,43,.9) } 100% { text-shadow: none } }
.acts { display: flex; align-items: center; gap: .8em; flex-wrap: wrap; margin-top: .3em; }
#spill { cursor: pointer; text-decoration: underline dotted; text-underline-offset: .2em; }
#spill:hover { color: var(--chalk); }
.demo-only { display: none; }
body.demo .demo-only { display: inline; }
.ack { margin: 0; min-height: 1.4em; font-size: var(--fs-s); }

/* ---------- panel: rules · mathematics · log ---------- */
.panel { border-left: 1px solid var(--oak); padding-left: var(--gap); }
.tabs { display: flex; gap: clamp(10px, 1.6vw, 28px); border-bottom: 1px solid var(--oak); margin-bottom: clamp(6px, 1.2vh, 14px); }
.tab {
  font-family: var(--serif); font-style: italic; font-size: var(--fs-l);
  color: var(--dust); padding: 0 0 .25em; border-bottom: 1px solid transparent; margin-bottom: -1px;
  transition: color .25s, border-color .25s;
}
.tab:hover { color: var(--chalk); }
.tab.on { color: var(--chalk); border-bottom-color: var(--chalk); }
.tabpane { display: none; min-height: 0; overflow: hidden; }
.tabpane.on { display: block; flex: 1; }
.tabpane { overflow-y: auto; scrollbar-width: none; }  /* safety valve for tiny viewports; hidden bar */
.tabpane::-webkit-scrollbar { display: none; }

.rules { margin: 0; padding: 0 0 0 2.6em; display: grid; gap: clamp(2px, .55vh, 8px); counter-reset: r; list-style: none; }
.rules li { position: relative; font-size: var(--fs); line-height: 1.38; }
.rules li::before {
  counter-increment: r; content: counter(r, lower-roman) ".";
  position: absolute; left: -2.9em; width: 2.2em; text-align: right;
  font-family: var(--mono); font-size: .78em; color: var(--dust); top: .22em;
}

.math { display: grid; gap: clamp(4px, .85vh, 11px); }
.mblock { border: 1px solid var(--oak); background: rgba(51,38,26,.32); padding: clamp(4px, .8vh, 10px) clamp(8px, 1vw, 14px); border-radius: 2px; }
.mtitle { display: block; font-style: italic; color: var(--dust); margin-bottom: .2em; font-size: var(--fs); }
.mblock pre { margin: 0; font-size: clamp(9.5px, 1.3vh, 13px); line-height: 1.45; color: var(--chalk); white-space: pre-wrap; overflow-wrap: anywhere; }

.log { width: 100%; border-collapse: collapse; font-size: clamp(9.5px, 1.4vh, 13.5px); }
.log th { font-weight: 400; color: var(--dust); text-align: left; padding: .25em .5em .35em 0; border-bottom: 1px solid var(--oak); }
.log td { padding: .28em .5em .28em 0; border-bottom: 1px dashed rgba(51,38,26,.9); white-space: nowrap; }
.log td.amber { color: var(--amber); }
.log td.dust { color: var(--dust); }
.log tr.new td { animation: rowin .8s ease-out; }
@keyframes rowin { from { opacity: 0 } to { opacity: 1 } }
#logNote { margin: .6em 0 0; }

/* ---------- footer ---------- */
.foot {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--gap);
  border-top: 1px solid var(--oak);
  padding: clamp(6px, 1vh, 12px) 0 clamp(8px, 1.4vh, 18px);
  font-size: var(--fs-s);
}
.foot-l { font-style: italic; }
.foot-r { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- narrow: the wall is allowed to scroll on a phone ---------- */
@media (max-width: 960px) {
  html, body { overflow: auto; }
  .wall { height: auto; min-height: 100vh; }
  .main { grid-template-columns: 1fr; }
  .cask-svg { height: 62vh; }
  .pour { grid-template-columns: 110px 1fr; }
  .candle-svg { height: 40vh; }
  .panel { border-left: 0; padding-left: 0; border-top: 1px solid var(--oak); padding-top: var(--pad); }
  .tabpane { overflow: visible; }
  .wall > * { min-width: 0; }
  .head, .head-l, .head-r { flex-wrap: wrap; }
  .foot { flex-direction: column; align-items: flex-start; }
  .foot-r { white-space: normal; text-align: left; }
}

/* ===================================================================
   the wizard — five chalk cards over the wall
   =================================================================== */
.wiz { position: fixed; inset: 0; z-index: 200; display: none; }
.wiz.on { display: block; }
.wiz-scrim {
  position: absolute; inset: 0;
  background: rgba(9, 7, 4, .78);
  backdrop-filter: blur(2px);
  animation: fade .35s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.wiz-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(760px, 92vw); max-height: min(86vh, 760px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1b150d 0%, var(--black) 100%);
  border: 1px solid var(--oak-2); border-radius: 3px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(201, 119, 43, .07);
  padding: clamp(18px, 3.4vh, 38px) clamp(20px, 3vw, 48px) clamp(14px, 2.2vh, 26px);
  overflow: hidden;
}
.wiz-card.in { animation: cardin .45s cubic-bezier(.2, .7, .3, 1); }
@keyframes cardin {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}
.wiz-x {
  position: absolute; top: 10px; right: 14px;
  color: var(--dust); font-size: 24px; line-height: 1; padding: 4px 8px;
}
.wiz-x:hover { color: var(--chalk); }
.wiz-tag { font-size: var(--fs-s); color: var(--dust); letter-spacing: .06em; }
.wiz-title {
  margin: .25em 0 .6em; font-weight: 400; font-style: italic;
  font-size: clamp(22px, 3.4vh, 38px); line-height: 1.15; color: var(--chalk);
}
.wiz-body { overflow-y: auto; scrollbar-width: none; flex: 1; min-height: 0; }
.wiz-body::-webkit-scrollbar { display: none; }
.wiz-body p { margin: 0 0 .7em; font-size: clamp(14px, 2vh, 19px); line-height: 1.5; color: var(--chalk); }
.wiz-body p b { font-weight: 400; color: var(--amber); }
.wiz-figwrap { float: right; width: min(300px, 40%); margin: 0 0 .6em 1.6em; }
.wiz-figwrap .wfig { width: 100%; height: auto; display: block; }
.wfig .wlab { font-family: var(--mono); font-size: 11px; }
.wiz-mono {
  margin: .8em 0; padding: clamp(8px, 1.4vh, 14px) clamp(10px, 1.2vw, 18px);
  border: 1px solid var(--oak); background: rgba(51, 38, 26, .32); border-radius: 2px;
  font-size: clamp(10.5px, 1.5vh, 14px); line-height: 1.55; color: var(--chalk);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.wiz-notes { margin: .6em 0 0; padding: 0; list-style: none; display: grid; gap: .35em; }
.wiz-notes li {
  font-style: italic; color: var(--dust); font-size: clamp(12.5px, 1.75vh, 16px);
  padding-left: 1.1em; position: relative;
}
.wiz-notes li::before { content: "—"; position: absolute; left: 0; }
.wiz-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  border-top: 1px solid var(--oak); margin-top: clamp(10px, 1.6vh, 18px); padding-top: clamp(10px, 1.4vh, 16px);
}
.wiz-dots { display: flex; gap: 9px; }
.wiz-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: none; border: 1px solid var(--dust); padding: 0;
  transition: background .25s, border-color .25s;
}
.wiz-dot.on { background: var(--amber); border-color: var(--amber); }
.wiz-dot:hover { border-color: var(--chalk); }
.wiz-nav { display: flex; gap: .6em; }

/* ===================================================================
   intro.js — chalk on oak, not the default white
   =================================================================== */
/* intro.js leaves the overlay at opacity 0 and dims through a huge shadow on the helper layer.
   The helper sits at z-index auto here, so that shadow paints under the wall and nothing dims.
   The overlay does the dimming instead, and the helper only draws the amber frame. */
.introjs-overlay { background: rgba(9, 7, 4, .74) !important; opacity: 1 !important; }
.introjs-helperLayer {
  background: rgba(201, 119, 43, .06) !important;
  border: 1px solid var(--amber) !important;
  border-radius: 2px !important;
  box-shadow: 0 0 26px rgba(201, 119, 43, .22) !important;
  z-index: 9999998 !important;
}
.introjs-tooltip.solera-intro {
  background: #1b150d; border: 1px solid var(--oak-2); border-radius: 3px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .65);
  max-width: 360px; min-width: 260px; padding: 4px 2px 2px;
  font-family: var(--serif); color: var(--chalk);
}
.solera-intro .introjs-tooltip-header { padding: 12px 16px 0; }
.solera-intro .introjs-tooltip-title {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 20px; line-height: 1.2; color: var(--chalk);
}
.solera-intro .introjs-tooltiptext {
  padding: 6px 16px 12px; font-size: 14.5px; line-height: 1.48; color: var(--chalk);
}
.solera-intro .introjs-tooltiptext i { color: var(--dust); }
.solera-intro .introjs-tooltipbuttons {
  border-top: 1px solid var(--oak); padding: 9px 14px; text-align: right;
}
.solera-intro .introjs-button {
  font-family: var(--serif); font-size: 14px; text-shadow: none;
  background: none; border: 1px solid var(--oak-2); border-radius: 2px;
  color: var(--chalk); padding: .25em .9em; transition: border-color .25s, color .25s;
}
.solera-intro .introjs-button:hover, .solera-intro .introjs-button:focus {
  background: none; border-color: var(--chalk); color: var(--chalk); box-shadow: none;
}
.solera-intro .introjs-disabled, .solera-intro .introjs-disabled:hover {
  color: var(--dust); border-color: var(--oak); background: none;
}
.solera-intro .introjs-skipbutton { color: var(--dust); border-color: transparent; }
.solera-intro .introjs-skipbutton:hover { color: var(--chalk); border-color: transparent; }
.solera-intro .introjs-bullets { padding: 8px 0 2px; }
.solera-intro .introjs-bullets ul li a {
  background: none; border: 1px solid var(--dust); width: 6px; height: 6px;
}
.solera-intro .introjs-bullets ul li a.active { background: var(--amber); border-color: var(--amber); width: 6px; }
.solera-intro .introjs-arrow.top, .solera-intro .introjs-arrow.top-right, .solera-intro .introjs-arrow.top-middle { border-bottom-color: var(--oak-2); }
.solera-intro .introjs-arrow.bottom, .solera-intro .introjs-arrow.bottom-right, .solera-intro .introjs-arrow.bottom-middle { border-top-color: var(--oak-2); }
.solera-intro .introjs-arrow.left, .solera-intro .introjs-arrow.left-bottom { border-right-color: var(--oak-2); }
.solera-intro .introjs-arrow.right, .solera-intro .introjs-arrow.right-bottom { border-left-color: var(--oak-2); }
/* the highlighted element has to come above the overlay, which is what intro.js raises it for */
.introjs-tooltipReferenceLayer { z-index: 100000000 !important; }

/* ===================================================================
   the wallet — RainbowKit, wearing the cellar's clothes
   =================================================================== */
#wallet { display: inline-flex; align-items: center; }
.wallet-on { display: inline-flex; align-items: center; gap: .5em; }
.wallet-on .btn, #wallet .btn { font-size: var(--fs); }
.wallet-on .mono { font-size: var(--fs-s); }
.btn.wallet-wrong { color: var(--amber); border-color: var(--amber); }
[data-rk] {
  --rk-fonts-body: 'EB Garamond', Garamond, serif;
  --rk-radii-modal: 3px;
  --rk-radii-menuButton: 2px;
  --rk-radii-actionButton: 2px;
  --rk-radii-connectButton: 2px;
}
[data-rk] button { letter-spacing: .01em; }
