/* Thank-you card studio: design gallery and editor (thank-you-cards.html only). */
.tyg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); gap: clamp(1rem, 2vw, 1.5rem); }
.tyg-card { display: flex; flex-direction: column; background: var(--surface, #FFFDF7); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: box-shadow var(--t-med, .2s) ease, transform var(--t-med, .2s) ease, border-color .2s; }
.tyg-card:hover { box-shadow: 0 12px 30px rgba(40, 32, 20, .12); transform: translateY(-2px); }
.tyg-card.is-on { border-color: var(--gold, #B89B63); box-shadow: 0 0 0 2px var(--gold, #B89B63), 0 12px 30px rgba(40, 32, 20, .12); }
.tyg-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 5; padding: 1.1rem; border: 0; background: radial-gradient(120% 90% at 50% 10%, #F8F4EC 0%, #E9E2D4 100%); cursor: zoom-in; overflow: hidden; }
.tyg-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 24px rgba(40, 30, 15, .22), 0 2px 5px rgba(40, 30, 15, .12); border-radius: 2px; transition: transform .35s ease; }
.tyg-card:hover .tyg-thumb img { transform: scale(1.025); }
.tyg-live { position: absolute; inset: 0; pointer-events: none; }
.tyg-live iframe { height: 100% !important; background: transparent !important; }
.tyg-peek { position: absolute; right: .7rem; bottom: .7rem; background: rgba(31, 42, 34, .82); color: #fff; font-size: .75rem; font-weight: 600; letter-spacing: .04em; padding: .3rem .65rem; border-radius: 999px; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.tyg-thumb:hover .tyg-peek, .tyg-thumb:focus-visible .tyg-peek { opacity: 1; transform: none; }
@media (hover: none) { .tyg-peek { opacity: 1; transform: none; } }
.tyg-body { display: grid; gap: .55rem; padding: .95rem 1rem 1.1rem; flex: 1; align-content: start; }
.tyg-body h3 { margin: 0; font-family: var(--font-display, 'Cormorant Garamond', serif); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.tyg-body p { margin: 0; font-size: .86rem; color: var(--muted, #5B665E); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tyg-body .btn { justify-self: start; margin-top: .2rem; }
.tyg-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tyg-tags:empty { display: none; }
.tyg-tag { font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #6B5428; background: #F3EBD9; border-radius: 999px; padding: .18rem .55rem; }
.tyg-modal { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.tyg-modal-frame { background: #EDE7DA; border-radius: 10px; overflow: hidden; }
.tyg-modal-frame iframe { height: min(70vh, 720px) !important; }
.tyg-modal-frame.solo iframe { height: min(76vh, 820px) !important; }
@media (max-width: 760px) { .tyg-modal { grid-template-columns: minmax(0, 1fr); } .tyg-modal-frame iframe { height: min(62vh, 560px) !important; } }

/* Editor */
.ty-form { gap: .75rem; }
.ty-sec { border: 1px solid var(--line); border-radius: 12px; background: var(--surface, #FFFDF7); }
.ty-sec > summary { cursor: pointer; list-style: none; padding: .85rem 1rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.ty-sec > summary::-webkit-details-marker { display: none; }
.ty-sec > summary::after { content: ""; width: .55rem; height: .55rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; opacity: .6; }
.ty-sec[open] > summary::after { transform: rotate(-135deg); }
.ty-sec > .stack, .ty-sec > p { padding: 0 1rem 1rem; }
.ty-sec[hidden] { display: none; }
.ty-captions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
.ty-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .75rem; }
.ty-colors .field[hidden] { display: none; }
.ty-form input[type="range"] { width: 100%; accent-color: var(--forest, #304638); }
.ty-form output { font-weight: 400; color: var(--muted); font-size: .85em; margin-left: .25rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: .45rem 1rem; font-size: .9rem; }
.seg input:checked + span { background: var(--forest, #304638); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--gold, #B89B63); outline-offset: -2px; }
.ty-slot { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; display: grid; gap: .6rem; transition: box-shadow .3s; }
.ty-slot.flash { box-shadow: 0 0 0 3px var(--gold, #B89B63); }
.ty-slot-head { display: flex; gap: .75rem; align-items: center; }
.ty-slot-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; flex: none; background: #E9E2D4; display: grid; place-items: center; color: #8C826F; font-weight: 600; }
.ty-slot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ty-slot-crop, .ty-el-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .4rem .9rem; font-size: .8rem; color: var(--muted); }
.ty-slot-crop[hidden] { display: none; }
.ty-slot-crop label, .ty-el-grid label { display: grid; gap: .15rem; }
.ty-slot-crop .link-btn { justify-self: start; align-self: end; }
.ty-elrow { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ty-elrow.is-on { border-color: var(--gold, #B89B63); }
.ty-elrow-head { width: 100%; display: flex; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.ty-elrow-body { padding: 0 .8rem .8rem; }

/* Preview: two frames stacked so the card does not flash while it reloads */
#ty-preview .scroll { position: relative; overflow: hidden; max-height: none; background: #EDE7DA; }
#ty-preview .scroll iframe.ty-next { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
@media (min-width: 900px) { .ty-preview-col { position: sticky; top: 5.5rem; } }
@media (max-width: 899px) {
  .ty-studio { display: flex; flex-direction: column; }
  .ty-studio .ty-preview-col { order: -1; }
}
