/* I Ching: ink and a cinnabar seal. Dark ink around, the hexagrams on rice
   paper, cinnabar for the changing lines. The shell is in base.css; here its
   colors are switched to ink. */

.o-iching {
  --bg: #11100e;
  --ink: #ece6d8;
  --muted: #b3aa98;
  --faint: #827a6b;
  --gold: #c9a463;
  --gold-hi: #f0dcae;
  --line: rgba(201, 164, 99, 0.3);
  --paper: #f1eadb;
  --paper-ink: #1c1915;
  --paper-muted: #6b6152;
  --cinnabar: #c0392b;
  --bronze: #a8844f;
  background:
    radial-gradient(120% 55% at 50% -10%, #2b2620 0%, #191713 50%, rgba(17, 16, 14, 0) 80%),
    var(--bg);
}

.o-iching .lang option {
  background: #24211c;
}

.ic {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px var(--gutter) 0;
}

.ic-top {
  text-align: center;
}

.ic-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(38px, 11vw, 58px);
  line-height: 1.1;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}

.ic-subtitle {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--muted);
}

.ic-h {
  margin: 30px 0 12px;
  text-align: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-hi);
}

/* ---------- coins and the lines being built ---------- */

.ic-cast {
  margin-top: 22px;
  text-align: center;
}

.ic-coins {
  display: flex;
  justify-content: center;
  gap: 18px;
  min-height: 84px;
}

.ic-coin {
  width: 76px;
  height: 76px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55));
}

.ic-coin-body {
  fill: var(--bronze);
}

.ic-coin-rim {
  fill: none;
  stroke: #6e5530;
  stroke-width: 2.4;
}

.ic-coin-marks path {
  fill: none;
  stroke: #4a381d;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.ic-coin.plain .ic-coin-marks {
  display: none;
}

.ic-coin.plain .ic-coin-body {
  fill: #b9955d;
}

.ic-coin.spin {
  animation: ic-flip 0.32s linear infinite;
}

@keyframes ic-flip {
  0%,
  100% {
    transform: scaleX(1) translateY(0);
  }
  50% {
    transform: scaleX(0.08) translateY(-10px);
  }
}

.ic-build {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 420px;
  margin: 18px auto 0;
}

.ic-build:empty {
  display: none;
}

.ic-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--paper);
  animation: ic-in 0.35s ease-out both;
}

@keyframes ic-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.ic-line {
  flex: none;
  width: 132px;
  height: 12px;
}

.ic-row-value {
  font-size: 14px;
  color: var(--paper-muted);
  text-align: start;
}

.ic-bar {
  fill: var(--paper-ink);
}

.ic-mark {
  fill: none;
  stroke: var(--cinnabar);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.ic-actions {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.ic-btn {
  min-width: min(100%, 280px);
  min-height: 52px;
  padding: 14px 32px;
  border: 1px solid #d9584a;
  border-radius: 999px;
  color: #fff6ee;
  background: linear-gradient(180deg, #d34d3e 0%, #b23426 60%, #8f2419 100%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.12s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.ic-btn:hover {
  filter: brightness(1.07);
}

.ic-btn:active {
  transform: translateY(1px);
}

.ic-btn:disabled {
  filter: saturate(0.5) brightness(0.8);
  cursor: default;
  transform: none;
}

.ic-hint,
.ic-note {
  max-width: 460px;
  margin: 12px auto 0;
  font-size: 14px;
  color: var(--faint);
  text-wrap: balance;
}

.ic-note {
  color: var(--muted);
}

/* ---------- the hexagram sheets ---------- */

.ic-result {
  margin-top: 28px;
  scroll-margin-top: 12px;
}

.ic-sheet {
  position: relative;
  padding: 22px 20px 20px;
  border-radius: 6px;
  color: var(--paper-ink);
  background:
    radial-gradient(110% 80% at 50% 30%, rgba(255, 253, 247, 0.6), rgba(255, 253, 247, 0) 70%),
    linear-gradient(180deg, #f5efe2 0%, var(--paper) 60%, #e6dcc7 100%);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}

.ic-second {
  margin-top: 22px;
}

.ic-sheet-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ic-figure {
  flex: none;
  width: 112px;
  height: 95px;
}

.ic-names {
  flex: 1;
  min-width: 0;
}

.ic-number {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

.ic-zh {
  margin: 2px 0 0;
  font-size: 26px;
  line-height: 1.2;
}

.ic-pinyin {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--paper-muted);
}

.ic-name {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.2;
}

.ic-essence {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--paper-muted);
}

/* the seal: the hexagram in white on cinnabar, stamped in the corner */
.ic-seal {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 44px;
  height: 44px;
  padding: 6px;
  border-radius: 4px;
  background: var(--cinnabar);
  transform: rotate(-4deg);
  opacity: 0.9;
}

.ic-seal-figure {
  display: block;
  width: 100%;
  height: 100%;
}

.ic-seal-figure .ic-bar {
  fill: #fbeee6;
}

.ic-trigrams {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(107, 97, 82, 0.35);
  font-size: 14px;
  color: var(--paper-muted);
}

.ic-tri {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ic-trigram {
  width: 22px;
  height: 19px;
}

.ic-part {
  margin-top: 14px;
}

.ic-part-h {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cinnabar);
}

.ic-part p {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
}

.ic-becomes {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

/* ---------- changing lines ---------- */

.ic-moving .ic-h {
  margin-top: 26px;
}

.ic-lines {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ic-moving-line {
  padding: 12px 16px;
  border-inline-start: 3px solid var(--cinnabar);
  border-radius: 4px;
  background: rgba(241, 234, 219, 0.06);
}

.ic-moving-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #e3786b;
}

.ic-moving-line p {
  margin: 3px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
}

.ic-still {
  border-inline-start-color: var(--faint);
}

.ic-still p {
  color: var(--muted);
}

.o-iching .status {
  margin-top: 16px;
}

/* ---------- how it works ---------- */

.ic-how {
  margin: 40px auto 0;
}

.ic-how p {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.o-iching .noscript {
  text-align: center;
  color: var(--muted);
}

@media (max-width: 480px) {
  .ic-sheet-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ic-figure {
    width: 96px;
    height: 81px;
  }
}

:is(:lang(ar), :lang(he), :lang(ka), :lang(hy)) :is(.ic-subtitle, .ic-pinyin, .ic-essence) {
  font-style: normal;
}

:is(:lang(ka), :lang(ar)) :is(.ic-number, .ic-part-h, .ic-becomes) {
  text-transform: none;
  letter-spacing: 0;
}
