/* TAROT widget — tüm renkler değişkenle; sitenin temasına göre :root veya .tarot-root üzerinde ezin. */
.tarot-root {
  --tarot-bg: transparent; --tarot-fg: #1f1b16; --tarot-muted: #6b6258; --tarot-accent: #8a5a2b;
  --tarot-card: #fffaf2; --tarot-border: #e3d6c3; --tarot-radius: 14px;
  --tarot-back-a: #050505; --tarot-back-b: #14110a; --tarot-back-line: #e2b43c;
  color: var(--tarot-fg); background: var(--tarot-bg); max-width: 920px; margin: 0 auto; padding: 16px; font: inherit; line-height: 1.55;
}
@media (prefers-color-scheme: dark) {
  .tarot-root { --tarot-fg: #f1e9dc; --tarot-muted: #b9ad9c; --tarot-accent: #e0b36f; --tarot-card: #241e17; --tarot-border: #4a3f31; }
}
.tarot-title { margin: 0 0 4px; font-size: 1.6rem; }
.tarot-lead { margin: 0 0 16px; color: var(--tarot-muted); }

/* ---- kurulum ---- */
.tarot-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.tarot-root .tarot-form > .tarot-select { width: auto; flex: 0 0 auto; }
.tarot-label { display: grid; gap: 4px; font-size: .85rem; color: var(--tarot-muted); }
.tarot-select { font: inherit; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--tarot-border); background: var(--tarot-card); color: var(--tarot-fg); min-height: 44px; }
.tarot-mode-title { margin: 0 0 10px; font-weight: 600; }
.tarot-modes { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .tarot-modes { grid-template-columns: 1fr 1fr; } }
.tarot-mode { font: inherit; display: grid; gap: 4px; text-align: start; padding: 16px 18px; min-height: 76px; border-radius: var(--tarot-radius); border: 2px solid var(--tarot-border); background: var(--tarot-card); color: var(--tarot-fg); cursor: pointer; transition: border-color .15s, transform .15s; }
.tarot-mode strong { font-size: 1.1rem; color: var(--tarot-accent); }
.tarot-mode span { color: var(--tarot-muted); font-size: .9rem; }
.tarot-mode:hover { border-color: var(--tarot-accent); transform: translateY(-1px); }
.tarot-btn { font: inherit; font-weight: 600; padding: 10px 20px; min-height: 44px; border-radius: 10px; border: 0; background: var(--tarot-accent); color: #fff; cursor: pointer; }
.tarot-btn-quiet { background: #000; color: var(--tarot-accent); border: 1px solid var(--tarot-accent); }
/* Sitenin kendi düğme stili (ör. koyu yazı rengi) ikincil düğmeyi ezmesin: siyah zemin, altın yazı */
.tarot-root .tarot-btn.tarot-btn-quiet { background: #000; color: var(--tarot-accent); border: 1px solid var(--tarot-accent); }
.tarot-root .tarot-btn.tarot-btn-quiet:hover:not(:disabled) { background: #14110a; }
.tarot-btn:disabled { opacity: .6; cursor: progress; }
.tarot-btn:focus-visible, .tarot-select:focus-visible, .tarot-mode:focus-visible, .tarot-deckcard:focus-visible { outline: 3px solid var(--tarot-accent); outline-offset: 2px; }
.tarot-btn[hidden], .tarot-table[hidden], .tarot-setup[hidden], .tarot-deckwrap[hidden], .tarot-legend[hidden] { display: none; }

/* ---- masa ---- */
.tarot-status { min-height: 1.6em; margin: 0 0 12px; color: var(--tarot-muted); }
.tarot-error { color: #b3261e; }
.tarot-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; justify-content: center; }
.tarot-board { margin: 0 auto 8px; --tarot-cardw: 120px; }

/* satır yerleşimi: 1 kart ortada, 3 kart yan yana */
.tarot-board-single, .tarot-board-row { display: flex; justify-content: center; gap: 12px; }
.tarot-board-single .tarot-slot, .tarot-board-row .tarot-slot { width: min(var(--tarot-cardw), 30vw); flex: 0 0 auto; aspect-ratio: 2 / 3; position: relative; }
.tarot-board-single .tarot-slot { width: min(150px, 42vw); }

/* Kelt Haçı: yüzdelerle konumlanır (widget.js) */
.tarot-board-celtic { position: relative; width: 100%; max-width: 620px; aspect-ratio: 5.5 / 6.6; }
.tarot-board-celtic .tarot-slot { position: absolute; }
.tarot-legend { list-style: decimal inside; margin: 0 auto 8px; padding: 0; max-width: 620px; columns: 2; font-size: .8rem; color: var(--tarot-muted); }
.tarot-legend li { break-inside: avoid; padding: 1px 0; }

/* yuva */
.tarot-slot-box { position: absolute; inset: 0; perspective: 900px; }
.tarot-slot-box::before { content: ''; position: absolute; inset: 0; border: 2px dashed var(--tarot-border); border-radius: 10px; background: color-mix(in srgb, var(--tarot-card) 70%, transparent); transition: border-color .2s, box-shadow .2s; }
.tarot-slot.is-next .tarot-slot-box::before { border-color: var(--tarot-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tarot-accent) 25%, transparent); animation: tarot-pulse 1.4s ease-in-out infinite; }
.tarot-slot.is-filled .tarot-slot-box::before { opacity: 0; }
.tarot-slot-label { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 3px; text-align: center; font-size: clamp(.52rem, 2.3vw, .8rem); line-height: 1.12; color: var(--tarot-muted); pointer-events: none; overflow-wrap: anywhere; }
.tarot-board-row .tarot-slot-label, .tarot-board-single .tarot-slot-label { font-size: clamp(.7rem, 2.8vw, .95rem); }
.tarot-slot.is-filled .tarot-slot-label { inset: auto 0 0 0; place-items: end center; background: rgba(20, 12, 28, .72); color: #fff; border-radius: 0 0 9px 9px; padding: 4px 3px; }
.tarot-slot.is-flipped .tarot-slot-label { display: none; }
/* Tek kart ve satır yerleşimi: yuva adı kartın ALTINDA yazar, kartın üstüne binmez (boş yuvada hâlâ kutunun içinde) */
.tarot-board-single .tarot-slot, .tarot-board-row .tarot-slot { margin-bottom: 2.6em; }
.tarot-board-single .tarot-slot.is-filled .tarot-slot-label, .tarot-board-row .tarot-slot.is-filled .tarot-slot-label,
.tarot-board-single .tarot-slot.is-flipped .tarot-slot-label, .tarot-board-row .tarot-slot.is-flipped .tarot-slot-label {
  display: block; inset: 100% 0 auto 0; background: none; color: var(--tarot-fg); border-radius: 0; padding: 7px 2px 0;
  text-align: center; font-size: clamp(.72rem, 2.9vw, .95rem); line-height: 1.2; font-weight: 600;
}
/* Kelt Haçı: kartlar yan yana sıkışık; dolu yuvada yazı yok (numara rozeti ve alttaki liste yeter) */
.tarot-board-celtic .tarot-slot.is-filled .tarot-slot-label, .tarot-board-celtic .tarot-slot.is-flipped .tarot-slot-label { display: none; }
.tarot-slot-num { position: absolute; top: 3px; inset-inline-start: 4px; z-index: 4; min-width: 1.35em; height: 1.35em; display: grid; place-items: center; border-radius: 50%; font-size: .68rem; font-weight: 700; background: var(--tarot-accent); color: #fff; pointer-events: none; }
.tarot-board-celtic .tarot-slot-num { font-size: .6rem; }

/* çapraz kart: kutu 90° döner, yazılar düz kalsın */
.tarot-slot-cross { z-index: 5; }
.tarot-slot-cross .tarot-slot-label, .tarot-slot-cross .tarot-slot-num { transform-origin: center; }
.tarot-slot-cross .tarot-slot-label { inset: auto; top: 50%; left: 50%; width: 150%; height: 66.67%; transform: translate(-50%, -50%) rotate(-90deg); background: none; color: var(--tarot-muted); border-radius: 0; place-items: center; }
.tarot-slot-cross.is-filled .tarot-slot-label { inset: auto; top: 50%; left: 50%; right: auto; bottom: auto; width: 150%; height: 66.67%; place-items: center; color: #fff; background: rgba(20, 12, 28, .55); border-radius: 8px; }
.tarot-slot-cross .tarot-slot-num { top: auto; bottom: 3px; left: 50%; inset-inline-start: auto; transform: translateX(-50%) rotate(-90deg); }
/* 1. kartın etiketi üstte kalsın (üstüne 2. kart biner) */
.tarot-board-celtic .tarot-slot:nth-child(1) .tarot-slot-label { place-items: start center; padding-top: 4px; font-size: clamp(.45rem, 1.9vw, .68rem); }

/* kart arkası ve çevirme */
.tarot-flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .65s cubic-bezier(.3, .7, .2, 1); opacity: 0; }
.tarot-slot.is-filled .tarot-flip { opacity: 1; }
.tarot-slot.is-flipped .tarot-flip { transform: rotateY(180deg); }
.tarot-back, .tarot-front { position: absolute; inset: 0; border-radius: 6% / 4%; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
/* Kart sırtı: siyah zemin, altın çerçeve, ortada soluk GLG feneri; karanlık fenerden yayılır (tarot-back.svg) */
.tarot-back, .tarot-deckcard {
  background: #000 url("tarot-back.svg") center / 100% 100% no-repeat;
  border: 0; border-radius: 6% / 4%;
}
.tarot-front { transform: rotateY(180deg); background: var(--tarot-card); border: 1px solid var(--tarot-border); display: grid; place-items: center; }
.tarot-face { width: 100%; height: 100%; display: grid; place-items: center; }
.tarot-face .tarot-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tarot-face-name { padding: 6px; text-align: center; font-size: .75rem; font-weight: 600; color: var(--tarot-accent); }
.tarot-reversed { transform: rotate(180deg); }
.tarot-slot.is-dealt .tarot-slot-box { animation: tarot-deal .45s ease-out backwards; }

/* kapalı kart destesi */
.tarot-deckwrap { margin-top: 18px; }
.tarot-deck-title { margin: 0 0 8px; font-size: .9rem; color: var(--tarot-muted); text-align: center; }
.tarot-deck { position: relative; isolation: isolate; display: flex; overflow-x: auto; padding: 14px 18px 18px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.tarot-deckcard { flex: 0 0 auto; width: 56px; height: 84px; margin-inline-start: -32px; cursor: pointer; scroll-snap-align: center; box-shadow: 4px 2px 8px rgba(0, 0, 0, .5); transition: transform .15s; padding: 0; }
.tarot-deckcard:first-child { margin-inline-start: 0; }
.tarot-deckcard:hover:not(:disabled), .tarot-deckcard:focus-visible { transform: translateY(-12px); z-index: 200 !important; }
.tarot-deckcard.is-taken { display: none; }
.tarot-deck.is-shuffling .tarot-deckcard { animation: tarot-shuffle .5s ease both; }
.tarot-deck.is-shuffling .tarot-deckcard:nth-child(even) { animation-direction: reverse; }

/* okuma */
.tarot-intro, .tarot-combos, .tarot-verdict, .tarot-note, .tarot-closing { margin: 0 0 14px; }
.tarot-combos, .tarot-verdict { font-weight: 600; }
.tarot-secs { display: grid; gap: 12px; margin: 0 0 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .tarot-secs-3 { grid-template-columns: repeat(3, 1fr); } .tarot-secs-10 { grid-template-columns: repeat(2, 1fr); } }
.tarot-sec { background: var(--tarot-card); border: 1px solid var(--tarot-border); border-radius: var(--tarot-radius); padding: 14px; display: grid; gap: 6px; align-content: start; }
.tarot-sec-head { display: flex; gap: 8px; align-items: center; }
.tarot-sec-num { min-width: 1.5em; height: 1.5em; display: grid; place-items: center; border-radius: 50%; font-size: .75rem; font-weight: 700; background: var(--tarot-accent); color: #fff; }
.tarot-pos { font-size: .8rem; color: var(--tarot-muted); text-transform: uppercase; letter-spacing: .04em; }
.tarot-text { margin: 0; }
.tarot-lead-in { color: var(--tarot-muted); }
.tarot-disclaimer { color: var(--tarot-muted); font-size: .85rem; border-top: 1px solid var(--tarot-border); padding-top: 12px; }
[dir="rtl"] .tarot-root, .tarot-root[dir="rtl"] { text-align: right; }

@keyframes tarot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes tarot-deal { from { opacity: 0; transform: translateY(-30px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes tarot-shuffle { 0% { transform: translateX(0); } 30% { transform: translateX(18px) rotate(4deg); } 60% { transform: translateX(-12px) rotate(-3deg); } 100% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) {
  .tarot-flip { transition: none; } .tarot-slot.is-next .tarot-slot-box::before { animation: none; }
  .tarot-slot.is-dealt .tarot-slot-box, .tarot-deck.is-shuffling .tarot-deckcard { animation: none; }
}
@media (prefers-reduced-motion: no-preference) { .tarot-sec { animation: tarot-in .35s ease both; } }
@keyframes tarot-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
