/* Tarocchi Italiani – frontend isolato per evitare conflitti con il tema. */
.ti-reader,
.ti-daily {
  --ti-accent: #6f4ba8;
  --ti-ink: #241d2e;
  --ti-muted: #6e6677;
  --ti-paper: #fffdf8;
  --ti-soft: #f6f0fb;
  --ti-border: rgba(67, 45, 84, 0.16);
  --ti-shadow: 0 24px 65px rgba(35, 22, 48, 0.14);
  color: var(--ti-ink);
  font-family: inherit;
  box-sizing: border-box;
}

.ti-reader *,
.ti-reader *::before,
.ti-reader *::after,
.ti-daily *,
.ti-daily *::before,
.ti-daily *::after {
  box-sizing: border-box;
}

.ti-reader {
  position: relative;
  isolation: isolate;
  width: min(100%, 1040px);
  margin: 2rem auto;
  padding: clamp(1rem, 3vw, 2.4rem);
  overflow: hidden;
  border: 1px solid var(--ti-border);
  border-radius: 28px;
  background:
    radial-gradient(circle at 85% 5%, color-mix(in srgb, var(--ti-accent) 16%, transparent), transparent 28%),
    linear-gradient(145deg, #fffefb 0%, #f8f2fb 100%);
  box-shadow: var(--ti-shadow);
}

.ti-reader__halo {
  position: absolute;
  z-index: -1;
  top: -210px;
  right: -170px;
  width: 430px;
  height: 430px;
  border: 1px solid color-mix(in srgb, var(--ti-accent) 28%, transparent);
  border-radius: 50%;
  box-shadow:
    0 0 0 32px color-mix(in srgb, var(--ti-accent) 4%, transparent),
    0 0 0 72px color-mix(in srgb, var(--ti-accent) 3%, transparent);
}

.ti-reader__header {
  max-width: 760px;
  margin-bottom: 1.5rem;
}

.ti-reader__header h2,
.ti-daily h2,
.ti-reader h3,
.ti-reader h4 {
  margin-top: 0;
  color: var(--ti-ink);
  line-height: 1.16;
  text-wrap: balance;
}

.ti-reader__header h2 {
  margin-bottom: 0.65rem;
  font-size: clamp(1.75rem, 4vw, 3rem);
  letter-spacing: -0.035em;
}

.ti-reader__intro,
.ti-reader__intro p {
  margin: 0;
  color: var(--ti-muted);
  font-size: clamp(1rem, 2vw, 1.1rem);
  line-height: 1.7;
}

.ti-reader__eyebrow {
  margin: 0 0 0.45rem;
  color: var(--ti-accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.ti-reader__panel,
.ti-reader__result {
  position: relative;
  border: 1px solid var(--ti-border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 35px rgba(36, 29, 46, 0.07);
  backdrop-filter: blur(9px);
}

.ti-reader__panel {
  padding: clamp(1rem, 3vw, 1.7rem);
}

.ti-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.ti-field {
  display: grid;
  gap: 0.45rem;
}

.ti-field--wide {
  margin: 1rem 0 1.15rem;
}

.ti-field label {
  font-weight: 750;
}

.ti-field label span {
  color: var(--ti-muted);
  font-size: 0.88em;
  font-weight: 500;
}

.ti-field select,
.ti-field textarea {
  width: 100%;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--ti-accent) 22%, #d8d2dd);
  border-radius: 12px;
  background: #fff;
  color: var(--ti-ink);
  font: inherit;
  line-height: 1.45;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.ti-field select {
  min-height: 48px;
  padding: 0.68rem 2.4rem 0.68rem 0.8rem;
}

.ti-field textarea {
  min-height: 92px;
  padding: 0.8rem;
  resize: vertical;
}

.ti-field select:focus,
.ti-field textarea:focus {
  border-color: var(--ti-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ti-accent) 18%, transparent);
}

.ti-field__hint {
  margin: 0;
  color: var(--ti-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.ti-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 780;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, opacity 150ms ease;
}

.ti-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ti-button:focus-visible,
.ti-card-back:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ti-accent) 44%, #fff);
  outline-offset: 3px;
}

.ti-button--primary {
  background: var(--ti-accent);
  color: #fff;
  box-shadow: 0 9px 24px color-mix(in srgb, var(--ti-accent) 30%, transparent);
}

.ti-button--ghost {
  border-color: color-mix(in srgb, var(--ti-accent) 28%, transparent);
  background: #fff;
  color: var(--ti-accent);
}

.ti-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.ti-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.ti-section-heading h3 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.ti-section-heading > p {
  margin: 0;
  color: var(--ti-muted);
  font-weight: 700;
  white-space: nowrap;
}

.ti-chooser__instruction {
  margin: 0 0 1rem;
  color: var(--ti-muted);
}

.ti-deck {
  display: grid;
  grid-template-columns: repeat(11, minmax(42px, 1fr));
  gap: clamp(0.4rem, 1vw, 0.75rem);
  padding: 0.45rem 0 1rem;
}

.ti-deck.is-shuffling {
  animation: ti-shuffle 420ms ease;
}

@keyframes ti-shuffle {
  0% { opacity: 0.6; transform: translateY(5px) scale(0.99); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.ti-card-back {
  position: relative;
  aspect-ratio: 0.63;
  min-width: 0;
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 10px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 3px, transparent 3px 8px),
    linear-gradient(150deg, color-mix(in srgb, var(--ti-accent) 84%, #24182f), #24182f);
  box-shadow: 0 7px 15px rgba(34, 22, 43, 0.18);
  color: #fff;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.ti-card-back:hover:not(:disabled) {
  z-index: 2;
  transform: translateY(-5px) rotate(-1deg);
  box-shadow: 0 12px 24px rgba(34, 22, 43, 0.26);
}

.ti-card-back:nth-child(even):hover:not(:disabled) {
  transform: translateY(-5px) rotate(1deg);
}

.ti-card-back.is-selected {
  background: color-mix(in srgb, var(--ti-accent) 52%, #19131f);
  opacity: 0.78;
  transform: translateY(3px);
}

.ti-card-back__frame {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 7px;
  background:
    radial-gradient(circle, transparent 0 18%, rgba(255, 255, 255, 0.13) 19% 20%, transparent 21% 36%, rgba(255, 255, 255, 0.1) 37% 38%, transparent 39%),
    linear-gradient(45deg, transparent 48%, rgba(255, 255, 255, 0.08) 49% 51%, transparent 52%);
}

.ti-card-back__star {
  font-size: clamp(0.7rem, 1.6vw, 1.25rem);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.75);
}

.ti-card-back__selected {
  display: grid;
  width: 70%;
  aspect-ratio: 1;
  place-items: center;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 900;
}

.ti-chooser__actions,
.ti-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.ti-chooser__actions {
  justify-content: space-between;
}

.ti-reader__result {
  padding: clamp(1rem, 3vw, 2rem);
}

.ti-result__header {
  margin-bottom: 1.35rem;
}

.ti-result__header h3 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
}

.ti-result__header p:last-child {
  margin: 0;
  color: var(--ti-muted);
}

.ti-reading-list {
  display: grid;
  gap: 1rem;
}

.ti-reading-card {
  display: grid;
  grid-template-columns: minmax(128px, 175px) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 1.6rem);
  padding: clamp(0.85rem, 2vw, 1.2rem);
  border: 1px solid var(--ti-border);
  border-radius: 18px;
  background: var(--ti-paper);
}

.ti-reading-card__visual {
  min-width: 0;
}

.ti-card-face {
  position: sticky;
  top: 1rem;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  width: 100%;
  aspect-ratio: 0.64;
  padding: 0.7rem;
  overflow: hidden;
  border: 4px double color-mix(in srgb, var(--ti-accent) 56%, #d5bd75);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--ti-accent) 13%, #fff) 0 23%, transparent 24%),
    linear-gradient(155deg, #fffdf5, #eee2f2);
  box-shadow: 0 14px 28px rgba(34, 22, 43, 0.17);
  text-align: center;
}

.ti-card-face__corner {
  justify-self: start;
  color: var(--ti-accent);
  font-size: 0.74rem;
  font-weight: 900;
}

.ti-card-face__art {
  display: grid;
  place-items: center;
  min-height: 0;
  font-size: clamp(2.1rem, 6vw, 4.6rem);
  line-height: 1;
  transition: transform 220ms ease;
}

.ti-card-face.is-reversed .ti-card-face__art span {
  transform: rotate(180deg);
}

.ti-card-face__name {
  align-self: end;
  font-size: clamp(0.75rem, 1.5vw, 0.95rem);
  font-weight: 900;
  line-height: 1.15;
}

.ti-card-face__meta {
  margin-top: 0.25rem;
  color: var(--ti-muted);
  font-size: 0.63rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ti-reading-card__content {
  min-width: 0;
}

.ti-reading-card__content h4 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
}

.ti-reading-card__content p {
  margin: 0.55rem 0;
  line-height: 1.68;
}

.ti-reading-card__position {
  margin-top: 0 !important;
  color: var(--ti-accent);
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ti-reading-card__orientation {
  color: var(--ti-muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.ti-reading-card__advice,
.ti-daily__advice {
  padding: 0.75rem 0.85rem;
  border-left: 4px solid var(--ti-accent);
  border-radius: 0 10px 10px 0;
  background: var(--ti-soft);
}

.ti-keywords {
  color: var(--ti-muted);
  font-size: 0.88rem;
}

.ti-synthesis {
  margin-top: 1.25rem;
  padding: clamp(1rem, 3vw, 1.6rem);
  border: 1px solid color-mix(in srgb, var(--ti-accent) 26%, transparent);
  border-radius: 18px;
  background:
    radial-gradient(circle at 95% 10%, color-mix(in srgb, var(--ti-accent) 11%, transparent), transparent 32%),
    var(--ti-soft);
}

.ti-synthesis h3 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
}

.ti-synthesis p {
  margin: 0.65rem 0;
  line-height: 1.72;
}

.ti-result__question {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.ti-disclaimer {
  margin: 1rem 0;
  color: var(--ti-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.ti-result-actions {
  padding-top: 0.25rem;
}

.ti-reader__status,
.ti-noscript {
  margin-top: 0.8rem;
  color: #8a2d2d;
  font-weight: 650;
}

.ti-slot {
  width: 100%;
  margin: 1.2rem auto;
  text-align: center;
}

.ti-daily {
  display: grid;
  grid-template-columns: minmax(160px, 230px) minmax(0, 1fr);
  gap: clamp(1.2rem, 4vw, 2.4rem);
  align-items: center;
  width: min(100%, 900px);
  margin: 2rem auto;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--ti-border);
  border-radius: 24px;
  background: linear-gradient(145deg, #fffefb, #f7f0fa);
  box-shadow: var(--ti-shadow);
}

.ti-daily__card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100%, 220px);
  aspect-ratio: 0.64;
  justify-self: center;
  padding: 1rem;
  border: 5px double color-mix(in srgb, var(--ti-accent) 58%, #d2b65f);
  border-radius: 14px;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--ti-accent) 13%, #fff) 0 28%, transparent 29%),
    linear-gradient(150deg, #fffdf5, #eee2f2);
  box-shadow: 0 16px 32px rgba(34, 22, 43, 0.2);
  text-align: center;
}

.ti-daily__number {
  justify-self: start;
  color: var(--ti-accent);
  font-weight: 900;
}

.ti-daily__symbol {
  display: grid;
  place-items: center;
  font-size: clamp(3rem, 9vw, 5.8rem);
}

.ti-daily__name {
  font-weight: 900;
  line-height: 1.15;
}

.ti-daily__content h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.ti-daily__content > p {
  line-height: 1.7;
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .ti-deck {
    grid-template-columns: repeat(7, minmax(40px, 1fr));
  }
}

@media (max-width: 640px) {
  .ti-reader {
    margin: 1rem auto;
    border-radius: 20px;
  }

  .ti-form-grid,
  .ti-reading-card,
  .ti-daily {
    grid-template-columns: 1fr;
  }

  .ti-section-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .ti-deck {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }

  .ti-card-back:nth-child(n+21) {
    display: none;
  }

  .ti-reading-card__visual {
    display: flex;
    justify-content: center;
  }

  .ti-card-face {
    position: relative;
    top: auto;
    width: min(58vw, 180px);
  }

  .ti-daily__card {
    width: min(58vw, 210px);
  }

  .ti-button {
    width: 100%;
  }

  .ti-chooser__actions,
  .ti-result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .ti-deck {
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }

  .ti-card-back:nth-child(n+17) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ti-reader *,
  .ti-reader *::before,
  .ti-reader *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  .ti-reader,
  .ti-reader .ti-reader__result,
  .ti-reader .ti-reader__result * {
    visibility: visible !important;
  }

  .ti-reader {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .ti-reader__header,
  .ti-reader__panel,
  .ti-reader__halo,
  .ti-slot,
  .ti-result-actions {
    display: none !important;
  }

  .ti-reader__result {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .ti-reading-card {
    break-inside: avoid;
  }
}

/* Versione 1.1: mazzo illustrato e combinazione cabalistica. */
.ti-card-back {
  background: #24182f url('../cards/card-back.svg') center / cover no-repeat;
}

.ti-card-back__frame,
.ti-card-back__star {
  opacity: 0;
}

.ti-card-face {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: transparent;
  box-shadow: 0 14px 28px rgba(34, 22, 43, 0.2);
}

.ti-card-face img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 0.6;
  border-radius: 13px;
  object-fit: cover;
  transition: transform 240ms ease;
}

.ti-card-face.is-reversed img {
  transform: rotate(180deg);
}

.ti-daily__card {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: 0 16px 32px rgba(34, 22, 43, 0.2);
  overflow: hidden;
}

.ti-daily__card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.ti-cabala {
  position: relative;
  margin-top: 1.25rem;
  padding: clamp(1rem, 3vw, 1.7rem);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #b68b28 42%, var(--ti-border));
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 0%, rgba(233, 201, 107, 0.28), transparent 35%),
    linear-gradient(145deg, #fffaf0, #f4ecfb);
  box-shadow: 0 14px 36px rgba(36, 29, 46, 0.09);
}

.ti-cabala h3 {
  margin-bottom: 1rem;
  font-size: clamp(1.35rem, 2.7vw, 1.9rem);
}

.ti-cabala__main {
  display: grid;
  grid-template-columns: minmax(150px, 0.65fr) minmax(240px, 1.35fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.ti-cabala__wheel {
  display: grid;
  place-items: center;
  min-height: 116px;
  padding: 0.8rem;
  border: 1px solid rgba(111, 75, 168, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.ti-cabala__wheel span {
  color: var(--ti-muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ti-cabala__wheel strong {
  color: var(--ti-accent);
  font-family: Georgia, serif;
  font-size: clamp(1.45rem, 3.2vw, 2.15rem);
}

.ti-cabala__numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.55rem, 2vw, 1rem);
  align-items: center;
}

.ti-cabala__numbers span {
  display: grid;
  width: min(100%, 105px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border: 4px double #b68b28;
  border-radius: 50%;
  background: #fffef8;
  color: #30203e;
  box-shadow: 0 9px 20px rgba(58, 38, 72, 0.14);
  font-family: Georgia, serif;
  font-size: clamp(1.65rem, 4vw, 2.45rem);
  font-weight: 800;
}

.ti-cabala__trace,
.ti-cabala__validity {
  margin: 0.65rem 0;
  line-height: 1.65;
}

.ti-cabala__validity {
  color: var(--ti-accent);
}

@media (max-width: 640px) {
  .ti-cabala__main {
    grid-template-columns: 1fr;
  }

  .ti-cabala__wheel {
    min-height: 90px;
  }

  .ti-cabala__numbers span {
    width: min(100%, 88px);
  }
}
