@import url("../style.css");

.symbolic-tool {
  --max: 1080px;
}

.tool-page .guardian-title {
  max-width: 760px;
}

.tool-page .lead strong {
  color: var(--accent);
  font-weight: 500;
}

.tool-page .role-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-page .role-item {
  min-height: 104px;
}

.interface-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.interface-card {
  min-height: 154px;
  padding: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.16)),
    rgba(0, 0, 0, 0.18);
}

.interface-card strong {
  display: block;
  margin: 8px 0;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 500;
}

.interface-card span,
.interface-card p {
  color: var(--muted);
  line-height: 1.65;
}

.language-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 14px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.disclaimer {
  margin: 14px 0 0;
  color: #d8d1c2;
  font-family: var(--serif);
}

.symbol-mark {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
  padding: 7px 10px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tool-output .result-title {
  color: var(--accent);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-output .question,
.tool-output .anchor {
  color: #e8e3d7;
  font-family: var(--serif);
}

.tool-output .input-held {
  color: var(--dim);
  font-size: 0.82rem;
}

.tool-page .field select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  outline: 0;
  color: var(--text);
  padding: 12px 38px 12px 12px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%) calc(100% - 18px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, var(--accent) 50%, transparent 50%) calc(100% - 13px) 50% / 7px 7px no-repeat,
    rgba(0, 0, 0, 0.22);
}

.tool-page .field select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.spread-desc {
  max-width: 68ch;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.spread-card {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.12)),
    rgba(0, 0, 0, 0.16);
}

.spread-card .symbol-module {
  margin-bottom: 4px;
}

.tarot-spread-result {
  display: grid;
  gap: 18px;
}

.tarot-spread-header {
  display: grid;
  gap: 4px;
}

.tarot-spread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(164px, 1fr));
  gap: 12px;
  align-items: start;
}

.tarot-spread-tile {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.18)),
    rgba(0, 0, 0, 0.18);
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.tarot-spread-tile:hover,
.tarot-spread-tile:focus-visible {
  border-color: var(--accent-line);
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tarot-spread-tile .position-title {
  min-height: 2.7em;
}

.tarot-spread-tile .tarot-module {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.tarot-spread-tile .tarot-card {
  width: min(100%, 150px);
}

.tarot-spread-tile .symbol-code {
  font-size: 0.58rem;
}

.tarot-spread-tile .symbol-name {
  max-width: 16ch;
  font-size: 0.78rem;
}

.tarot-spread-tile .symbol-sub {
  font-size: 0.52rem;
}

.tarot-overall-reading {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 16px;
  border: 1px solid var(--accent-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.18)),
    rgba(0, 0, 0, 0.2);
}

.tarot-overall-reading h3,
.tarot-reading-block h4 {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tarot-overall-reading h3 {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.tarot-reading-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.tarot-reading-block h4 {
  color: var(--muted);
  font-size: 0.72rem;
}

.tarot-reading-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tarot-reading-tags li {
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: #e8e3d7;
  font-size: 0.78rem;
  line-height: 1.4;
  text-transform: uppercase;
}

.tarot-overall-reading .question {
  max-width: 78ch;
}

.tarot-overall-reading .hank {
  margin-top: 2px;
}

.position-title {
  color: var(--accent);
  font-size: 0.84rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.symbol-module {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 360px);
  margin: 0 0 18px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(217, 208, 189, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.18)),
    radial-gradient(circle at 50% 8%, var(--accent-soft), transparent 46%),
    rgba(0, 0, 0, 0.28);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 18px 44px rgba(0, 0, 0, 0.32),
    0 0 30px var(--accent-soft);
}

.symbol-module::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.038) 0, rgba(255, 255, 255, 0.038) 1px, transparent 1px, transparent 7px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.18));
  opacity: 0.48;
  mix-blend-mode: screen;
}

.symbol-code,
.symbol-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.symbol-name {
  margin: 0;
  color: var(--text);
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.tarot-card-shell {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
}

.tarot-card {
  position: relative;
  width: min(100%, 280px);
  aspect-ratio: 2 / 3.18;
  overflow: hidden;
  border: 1px solid rgba(217, 208, 189, 0.34);
  background: rgba(0, 0, 0, 0.54);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 40%),
    rgba(0, 0, 0, 0.54);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.44),
    0 18px 42px rgba(0, 0, 0, 0.34);
  perspective: 1200px;
}

.tarot-card-flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 680ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tarot-card.is-revealed .tarot-card-flip {
  transform: rotateY(180deg);
}

.tarot-card-static .tarot-card-image {
  position: absolute;
  inset: 0;
}

.tarot-card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
}

.tarot-card-front {
  transform: rotateY(180deg);
}

.tarot-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tarot-card::after {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 2;
  border: 1px solid rgba(217, 208, 189, 0.18);
  pointer-events: none;
}

.tarot-single-result {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.tarot-single-result .tarot-card {
  width: min(100%, 320px);
  aspect-ratio: 2 / 3;
}

.tarot-single-result .tarot-card-image {
  object-fit: contain;
  background: rgba(0, 0, 0, 0.72);
}

.tarot-result-details {
  width: min(100%, 720px);
}

.tarot-modal[hidden] {
  display: none;
}

.tarot-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 30px);
}

.tarot-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(5px);
}

.tarot-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  border: 1px solid var(--accent-line);
  background:
    linear-gradient(180deg, var(--panel-strong), rgba(8, 6, 5, 0.96)),
    rgba(0, 0, 0, 0.92);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.68);
}

.tarot-modal-close {
  position: sticky;
  top: 0;
  z-index: 2;
  display: block;
  width: fit-content;
  margin-left: auto;
  border: 0;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.52);
  color: var(--text);
  padding: 9px 12px;
  cursor: pointer;
  text-transform: uppercase;
}

.tarot-modal-close:hover,
.tarot-modal-close:focus-visible {
  color: #fff8e8;
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tarot-modal-body {
  display: grid;
  grid-template-columns: minmax(220px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
  padding: 0 18px 18px;
}

.tarot-modal-figure {
  min-width: 0;
  margin: 0;
}

.tarot-modal-image {
  display: block;
  width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border: 1px solid rgba(217, 208, 189, 0.28);
  background: rgba(0, 0, 0, 0.42);
}

body.tarot-modal-open {
  overflow: hidden;
}

.symbol-svg {
  width: min(72%, 150px);
  margin-top: auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  filter: drop-shadow(0 0 9px var(--accent-soft));
}

.symbol-svg .svg-faint {
  opacity: 0.44;
}

.hexagram-plate {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 300px);
  padding: 18px 18px 16px;
  border: 1px solid rgba(217, 208, 189, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.3)),
    rgba(0, 0, 0, 0.18);
}

.hex-number {
  margin: 0;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
}

.hexagram-lines {
  display: grid;
  gap: 8px;
  width: min(100%, 210px);
}

.hex-line {
  display: grid;
  height: 10px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-soft);
}

.hex-line.broken {
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  background: transparent;
}

.hex-line.broken span {
  display: block;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-soft);
}

.rune-slab {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 238px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid rgba(198, 166, 92, 0.3);
  background:
    repeating-linear-gradient(150deg, rgba(255, 255, 255, 0.03) 0, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 8px),
    radial-gradient(circle at 50% 35%, rgba(198, 166, 92, 0.12), transparent 46%),
    rgba(0, 0, 0, 0.28);
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(5rem, 14vw, 8.8rem);
  line-height: 1;
  text-shadow:
    1px 1px 0 rgba(0, 0, 0, 0.86),
    -1px -1px 0 rgba(255, 255, 255, 0.08),
    0 0 16px var(--accent-soft);
}

.rune-slab::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0 46%, rgba(255, 255, 255, 0.12) 48%, transparent 51% 100%);
  opacity: 0.22;
}

.dormant-core {
  display: grid;
  place-items: center;
  width: min(100%, 220px);
  min-height: 150px;
  color: var(--accent);
  border: 1px solid rgba(217, 208, 189, 0.18);
  background: rgba(0, 0, 0, 0.18);
  font-size: clamp(2.8rem, 9vw, 5rem);
  letter-spacing: 0.08em;
  text-shadow: 0 0 14px var(--accent-soft);
}

.tool-output.is-loading {
  color: var(--muted);
}

.tool-output.is-error {
  border-color: rgba(212, 123, 91, 0.42);
  color: #f0c0ad;
}

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.tool-nav a {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.tool-nav a:hover,
.tool-nav a[aria-current="page"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
}

@media (max-width: 680px) {
  .interface-grid,
  .tool-page .role-grid {
    grid-template-columns: 1fr;
  }

  body[data-tool="tarot"] .tool-output {
    padding: 12px;
    overflow-x: hidden;
  }

  .tarot-module {
    width: 100%;
  }

  .tarot-single-result .tarot-card {
    width: min(100%, 280px);
  }

  .tarot-spread-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .tarot-spread-tile {
    padding: 9px;
  }

  .tarot-spread-tile .position-title {
    min-height: 3.2em;
    font-size: 0.7rem;
  }

  .tarot-spread-tile .tarot-card {
    width: min(100%, 138px);
  }

  .tarot-overall-reading {
    padding: 12px;
  }

  .tarot-reading-tags li {
    width: 100%;
    font-size: 0.72rem;
  }

  .tarot-modal {
    padding: 10px;
  }

  .tarot-modal-dialog {
    max-height: 92vh;
  }

  .tarot-modal-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 0 12px 14px;
  }

  .tarot-modal-image {
    max-height: 56vh;
  }
}

@media (max-width: 420px) {
  .tarot-spread-tile .symbol-code,
  .tarot-spread-tile .symbol-sub {
    display: none;
  }

  .tarot-spread-tile .symbol-name {
    font-size: 0.7rem;
  }
}

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