/* intangibility.observer: woodblock and ink on rice paper.
   Washi ground, sumi ink, one cinnabar seal. The hexagram is the one
   loud thing on a page; everything around it stays quiet. The fonts
   are self-hosted (SIL OFL, licenses beside them in fonts/). */

@font-face {
  font-family: "Shippori Mincho B1";
  font-weight: 500;
  font-display: swap;
  src: url(fonts/shippori-mincho-b1-500.woff2) format("woff2");
}
@font-face {
  font-family: "Shippori Mincho B1";
  font-weight: 800;
  font-display: swap;
  src: url(fonts/shippori-mincho-b1-800.woff2) format("woff2");
}
/* The 71 characters of the hexagrams' Chinese names, cut from the same
   OFL Shippori Mincho B1 (fonts.googleapis.com css2 ?text=, 2026-10-23). */
@font-face {
  font-family: "Shippori Mincho B1";
  font-weight: 500;
  font-display: swap;
  src: url(fonts/shippori-mincho-b1-han.woff2) format("woff2");
  unicode-range: U+4E00-9FFF;
}
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/eb-garamond.woff2) format("woff2");
}
@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/eb-garamond-italic.woff2) format("woff2");
}

:root {
  --paper: #ece6d6;
  --paper-2: #e2d9c3;
  --ink: #1c1b18;
  --wash: #67635a;
  --faded: #b8af9b;
  --seal: #b3301c;
  --seal-ink: #f5efe0;
  --display: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --book: "EB Garamond", Garamond, "Iowan Old Style", Georgia, serif;
  --measure: 36rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171612;
    --paper-2: #221f19;
    --ink: #e6dfcc;
    --wash: #9d9685;
    --faded: #4a463b;
    --seal: #c9452e;
    --seal-ink: #f5efe0;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--book);
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums;
}

a { color: inherit; text-decoration-color: var(--faded); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--seal); }

:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 800; line-height: 1.25; margin: 0; }

/* ── frame ── */

/* One column, centred in the window: the header, the throw page, the
   lists at its full width; the texts at the measure, centred in it. */
.frame {
  max-width: calc(44rem + 32px);
  margin: 0 auto;
  padding: 0 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* The header and the page fill the window at least; the contact line
   follows, just below the fold. */
.screen { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.screen > main { flex: 1 0 auto; display: flex; flex-direction: column; padding-bottom: 2.5rem; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: max(1.25rem, env(safe-area-inset-top)) 0 1.25rem;
  margin-bottom: 2.5rem;
}

.brand {
  font: 800 1.35rem/1 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.top nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }

.top nav a {
  font: 500 0.95rem/1.8 var(--display);
  color: var(--wash);
  text-decoration: none;
  position: relative;
}
.top nav a:hover { color: var(--ink); }
.top nav a.here { color: var(--ink); }
.top nav a.here::after {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  bottom: -0.15rem;
  width: 6px;
  height: 6px;
  background: var(--seal);
}

/* ── buttons ── */

button {
  font: 500 1rem/1.2 var(--display);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover:not(:disabled) { background: var(--paper-2); }
button:active:not(:disabled) { background: var(--ink); color: var(--paper); }
button:disabled { color: var(--faded); border-color: var(--faded); cursor: default; }

button.read {
  background: var(--seal);
  border-color: var(--seal);
  color: var(--seal-ink);
  font-weight: 800;
  font-size: 1.2rem;
  padding: 0.85rem 2.4rem;
}
button.read:hover { background: var(--seal); filter: brightness(1.08); }

button.danger { border-color: var(--seal); color: var(--seal); }

button.undo {
  border: 0;
  padding: 0.4rem 0;
  color: var(--wash);
  text-decoration: underline;
  text-decoration-color: var(--faded);
  text-underline-offset: 0.2em;
  font-size: 0.95rem;
}
button.undo:hover:not(:disabled) { background: none; color: var(--ink); }
button.undo:disabled { color: var(--faded); text-decoration: none; }

/* ── the figures ── */

svg.defs { position: absolute; width: 0; height: 0; }

/* A changing mark on the top or bottom line reaches past the viewBox. */
svg.hexagram, svg.one-line { overflow: visible; }

.hexagram .bar, .one-line .bar { fill: var(--ink); }
.hexagram .bar.ink { filter: url(#ink); }
.hexagram .slot { fill: none; stroke: var(--faded); stroke-dasharray: 3 4; }
.mark { fill: none; stroke: var(--seal); stroke-width: 3; stroke-linecap: round; }
.mark.dot { fill: var(--seal); stroke: var(--paper); stroke-width: 1.5; }
.big-marks .mark { stroke-width: 4.5; }
.big-marks .mark.dot { stroke-width: 2; }

.hexagram.big { display: block; width: 100%; max-width: 12.5rem; height: auto; margin: 0 auto; }

.seal {
  display: inline-grid;
  place-items: center;
  min-width: 2.3em;
  height: 2.3em;
  padding: 0 0.3em;
  background: var(--seal);
  color: var(--seal-ink);
  font: 800 1rem/1 var(--display);
  transform: rotate(-3deg);
  filter: url(#stamp);
}

.figures {
  display: grid;
  grid-template-columns: minmax(0, 10rem) auto minmax(0, 10rem);
  justify-content: center;
  align-items: start;
  column-gap: clamp(0.75rem, 4vw, 2rem);
  margin: 1.5rem 0 2rem;
}

.figure { margin: 0; }
.figure .hexagram.big { max-width: 9.5rem; }
.figure .seal { font-size: clamp(0.85rem, 3.4vw, 1rem); }
.figure figcaption {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
}
.figure .name { font: 800 1.05rem/1.25 var(--display); }

.becomes {
  align-self: start;
  margin-top: clamp(1.4rem, 7vw, 3.1rem);
  font: 500 clamp(1.6rem, 6vw, 2.2rem)/1 var(--display);
  color: var(--wash);
  text-align: center;
}

/* A saved reading's figures, half size: the text is the page there. */
.figures.small { grid-template-columns: minmax(0, 7rem) auto minmax(0, 7rem); margin: 3rem 0 0; }
.figures.small .hexagram.big { max-width: 2.4rem; }
.figures.small.one { grid-template-columns: minmax(0, 10rem); }
.figures.small .seal { font-size: 0.8rem; }
.figures.small figcaption { margin-top: 0.6rem; column-gap: 0.5rem; }
.figures.small .name { font-size: 0.9rem; }
.figures.small .becomes { margin-top: 0.4rem; font-size: 1.2rem; }

/* ── cast ── */

.entry { display: block; margin-bottom: 1.5rem; }
.entry span { display: block; font: 500 0.95rem/1.4 var(--display); color: var(--wash); }
.entry input {
  display: block;
  width: 100%;
  max-width: 14rem;
  margin-top: 0.4rem;
  padding: 0.4rem 0;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  font: 500 1.6rem/1.2 var(--display);
  letter-spacing: 0.3em;
  font-variant-numeric: lining-nums tabular-nums;
}
.entry input:focus { outline: none; border-bottom-color: var(--seal); }

/* The cast page fills the window: the entry at the top, the hexagram
   and the ones that still fit centred in the middle, the question and
   Read at the foot. */
.cast { flex: 1 0 auto; display: flex; flex-direction: column; }
.cast-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.cast-top .entry { margin-bottom: 0; flex: 0 1 14rem; }
.tr-pick { display: grid; justify-items: end; gap: 0.3rem; }
.tr-pick a { font-size: 0.8rem; color: var(--wash); }

.casting {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 4vw, 2.5rem);
  align-items: center;
  padding: 2rem 0;
}
.building > .hexagram.big { width: 100%; max-width: 11rem; margin: 0 auto; }
.fits { max-height: 15rem; overflow-y: auto; overscroll-behavior: contain; }

.ask { display: grid; gap: 1rem; justify-items: start; }

textarea.question {
  display: block;
  width: 100%;
  padding: 0.4rem 0;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  font: 400 1.35rem/1.45 var(--book);
  resize: vertical;
}
textarea.question::placeholder { color: var(--faded); font-style: italic; }
textarea.question:focus { outline: none; border-bottom-color: var(--seal); }

button.read.small { font-size: 1rem; padding: 0.55rem 1.5rem; }
button.read:disabled { background: transparent; color: var(--faded); border-color: var(--faded); filter: none; }

/* The welcome, and History with nothing in it: the text, then the
   large Throw centred in the space left. */
.welcome, .none { flex: 1 0 auto; display: flex; flex-direction: column; }
.welcome .prose { margin: auto; padding-top: 2rem; text-align: center; }
.welcome p { font-size: 1.3rem; hyphens: none; }
.welcome .go { flex: 0 0 auto; padding: 3rem 0 2rem; }
.go { flex: 1 0 auto; display: grid; place-items: center; padding: 3rem 0; }
.history .none .go { padding-top: 6rem; align-items: start; }
button.read.throw { font-size: 1.5rem; padding: 1rem 3.5rem; }


.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
  gap: 0.4rem;
}

.tile {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.45rem 0.35rem;
  background: var(--paper-2);
  transition: opacity 0.35s ease;
}
.tile .hexagram { width: 100%; height: auto; }
.tile span { font: 500 0.8rem/1 var(--display); color: var(--wash); }


/* ── the translation picker ── */

.picker { border: 0; padding: 0; margin: 0; }
.picker legend { padding: 0; margin-bottom: 0.5rem; font: 500 0.95rem/1.4 var(--display); color: var(--wash); }
.picker label { display: inline-block; margin: 0 0.35rem 0.35rem 0; cursor: pointer; }
.picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.picker span {
  display: inline-block;
  padding: 0.5rem 0.95rem;
  border: 1.5px solid var(--faded);
  border-radius: 2px;
  font: 500 1rem/1.2 var(--display);
}
.picker input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.picker input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 3px; }

/* ── reading and the prose pages ── */

.when { margin: 0; color: var(--wash); font-variant-numeric: lining-nums tabular-nums; }
.reading .when { font: 500 1.45rem/1.3 var(--display); }
.reading { width: 100%; max-width: var(--measure); margin-inline: auto; }
.reading .asked { margin: 0.5rem 0 0; }

.hex-title {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.han {
  font: 500 clamp(2.6rem, 11vw, 3.4rem)/1 var(--display);
  white-space: nowrap;
}
.hex-title h2 { margin: 0; }
.pinyin { margin: 0.15rem 0 0; color: var(--wash); font-style: italic; }

.text { max-width: var(--measure); }
.prose { width: 100%; max-width: var(--measure); margin-inline: auto; }
.text { margin-top: 3rem; }
.text h2, .prose h2 { font-size: 1.45rem; margin: 2.5rem 0 1rem; }
.prose h3 { font-size: 1.15rem; margin: 1.75rem 0 0.6rem; }
.text > h2:first-child { margin-top: 0; }
.prose h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); margin: 0.5rem 0 1.25rem; }
.text h4 {
  margin: 2rem 0 0.75rem;
  font: 500 0.9rem/1.4 var(--display);
  letter-spacing: 0.06em;
  color: var(--wash);
}
.text p, .prose p { margin: 0 0 1em; hyphens: auto; }
.text blockquote {
  margin: 0 0 1em;
  padding-left: 1rem;
  border-left: 2px solid var(--faded);
}
.text blockquote p { margin: 0; }
.text p.line { margin-top: 2.2rem; font: 500 1.05rem/1.5 var(--display); }
.text.lines > p.line:first-of-type { margin-top: 0; }

.reading footer { margin-top: 3rem; }

/* The translation and download menus, small, at the right under the
   header. */
.tools { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; margin: -1.5rem 0 1rem; }

.tr-menu { position: relative; display: inline-block; }
.tr-menu select {
  appearance: none;
  -webkit-appearance: none;
  font: 500 0.85rem/1.2 var(--display);
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  padding: 0.4rem 1.7rem 0.4rem 0.7rem;
  cursor: pointer;
}
.tr-menu select option { background: var(--paper); color: var(--ink); }
.tr-menu::after {
  content: "▾";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wash);
  font-size: 0.85rem;
  pointer-events: none;
}

.download { position: relative; display: inline-block; }
.download summary {
  list-style: none;
  font: 500 0.85rem/1.2 var(--display);
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}
.download summary::-webkit-details-marker { display: none; }
.download summary::after { content: " ▾"; color: var(--wash); }
.download[open] summary { background: var(--ink); color: var(--paper); }
.download[open] summary::after { color: inherit; }
.download .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 1;
  display: grid;
  min-width: 100%;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 2px;
}
.download .menu button { border: 0; border-radius: 0; text-align: left; white-space: nowrap; font-size: 0.9rem; padding: 0.5rem 0.8rem; }
.download .menu button + button { border-top: 1px solid var(--faded); }
.source { font-size: 0.8rem; font-style: italic; color: var(--wash); }

.prose ul { padding-left: 1.2rem; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--seal); }

.prose table { border-collapse: collapse; margin: 0 0 1.5rem; width: 100%; font-variant-numeric: lining-nums; }
.prose th { text-align: left; font: 500 0.9rem/1.4 var(--display); color: var(--wash); padding: 0 0.75rem 0.4rem 0; }
.prose td { padding: 0.4rem 0.75rem 0.4rem 0; border-top: 1px solid var(--faded); vertical-align: middle; }
.prose td .one-line { width: 5rem; height: 0.7rem; display: block; overflow: visible; }

.contact { padding: 1.5rem 0 2rem; font-size: 0.8rem; text-align: center; }
.contact a { color: var(--faded); text-decoration: none; }

.empty { color: var(--wash); }

/* The name over a hexagram on the throw page (iching.app/tip!). */
.tip {
  display: none;
  position: fixed;
  z-index: 2;
  padding: 0.3rem 0.6rem;
  background: var(--ink);
  color: var(--paper);
  font: 500 0.85rem/1.2 var(--display);
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}

/* ── the 64 ── */

.hex-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0 2rem;
}
.hex-list a {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.9rem;
  align-items: center;
  padding: 0.55rem 0;
  text-decoration: none;
}
.hex-list a:hover span { text-decoration: underline; text-decoration-color: var(--seal); }
.hex-list .hexagram { width: 100%; height: auto; }

/* ── readings ── */

.readings { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.readings a {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1.35rem 0;
  text-decoration: none;
}
.readings a:hover .q { text-decoration: underline; text-decoration-color: var(--seal); }
.readings .hexagram { width: 100%; height: auto; }
.readings .what { display: grid; gap: 0.15rem; }
.readings .q { font-style: italic; }
.readings .h { color: var(--wash); }
.readings .when { margin: 0; font-size: 0.9rem; }

/* ── options ── */

.options section { margin-bottom: 2.75rem; }
.options h2 { margin-top: 0; }
.prose p.subscribe { margin-top: 3rem; }
.options .more { margin: 0.25rem 0 0; font-size: 0.95rem; }
.check { display: flex; gap: 0.5rem; align-items: center; margin: 0 0 1rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--seal); }
.wipe-steps .confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-top: 1.25rem; }
.done { font: 500 1rem/1.4 var(--display); color: var(--seal); }

.signup .field { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.signup input[type="email"] {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--faded);
  border-radius: 2px;
  font: 400 1.1rem/1.2 var(--book);
}
.signup input[type="email"]:focus { outline: none; border-color: var(--ink); }
.signup .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.list-page .keep a { word-break: break-all; }
.list-page .small { font-size: 0.95rem; color: var(--wash); }
.list-page .back { margin-top: 2.5rem; }

.noscript { max-width: var(--measure); margin: 3rem auto; padding: 0 16px; }

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}

@media print {
  .top nav, .tools { display: none; }
}
