/* =========================================================================
   Interactive Advent Calendar — scoped styles (loaded only on this page).
   Reuses the theme CSS custom properties (--hmtc-*).
   ========================================================================= */

/* ---- Shared primitives (this page does not load the planner CSS) ---- */
.hmtcb-btn { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; line-height: 1.1; transition: background .15s ease, transform .12s ease; }
.hmtcb-btn:hover { transform: translateY(-1px); }
.hmtcb-btn--primary { background: var(--hmtc-red); color: #fff; }
.hmtcb-btn--primary:hover { background: #a81f1f; }
.hmtcb-btn--ghost { background: #eef2f9; color: var(--hmtc-deep-blue); }
.hmtcb-btn--ghost:hover { background: #e0e8f5; }
.hmtcb-btn--danger { background: #fdecec; color: #a81f1f; }
.hmtcb-btn--tiny { padding: 6px 12px; font-size: .82rem; }
.hmtcb-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.hmtcb-save-status { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--hmtc-muted); }
.hmtcb-save-status__dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa7bd; }
.hmtcb-save-status[data-state="saving"] .hmtcb-save-status__dot { background: var(--hmtc-gold); }
.hmtcb-save-status[data-state="saved"] .hmtcb-save-status__dot { background: #2e9e5b; }
.hmtcb-save-status[data-state="error"] .hmtcb-save-status__dot { background: var(--hmtc-red); }

.hmtc-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.hmtc-field label { font-weight: 600; font-size: .9rem; color: var(--hmtc-deep-blue); }
.hmtc-field input, .hmtc-field textarea, .hmtc-field select { font: inherit; padding: 10px 12px; border: 1.5px solid #d3dcea; border-radius: 10px; background: #fff; color: var(--hmtc-ink); width: 100%; }
.hmtc-field--inline { margin-bottom: 0; }
.hmtc-field input:focus, .hmtc-field textarea:focus, .hmtc-field select:focus { outline: 3px solid var(--hmtc-gold); outline-offset: 1px; }

.hmtcb-dialog { border: 0; border-radius: 16px; padding: 0; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(11,30,63,.3); }
.hmtcb-dialog::backdrop { background: rgba(11,30,63,.45); }
.hmtcb-dialog__form { padding: 22px; }
.hmtcb-dialog__title { margin: 0 0 10px; color: var(--hmtc-deep-blue); }
.hmtcb-dialog__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

:focus-visible { outline: 3px solid var(--hmtc-gold); outline-offset: 2px; }

/* ---- Layout shell ---- */
.hmtc-advent { padding: 8px 0 24px; }
.hmtc-adv-h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); color: var(--hmtc-deep-blue); margin-bottom: .5rem; }
.hmtc-adv-controls, .hmtc-adv-progress, .hmtc-adv-gridwrap, .hmtc-adv-tools, .hmtc-adv-cta {
	background: #fff; border: 1px solid rgba(11,30,63,.07); border-radius: var(--hmtc-radius);
	box-shadow: var(--hmtc-shadow-sm); padding: 22px; margin: 22px auto;
}

/* ---- Header ---- */
.hmtc-adv-header { text-align: center; position: relative; padding: 26px 20px 6px; }
.hmtc-adv-header__deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hmtc-adv-snip { position: absolute; font-size: 1.4rem; opacity: .5; animation: hmtc-adv-float 7s ease-in-out infinite; }
.hmtc-adv-snip--1 { left: 8%; top: 12px; } .hmtc-adv-snip--2 { right: 10%; top: 6px; animation-delay: 1.6s; } .hmtc-adv-snip--3 { left: 24%; top: 46px; animation-delay: 3s; }
@keyframes hmtc-adv-float { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(6deg); } }
.hmtc-adv-title { font-size: clamp(1.9rem, 5vw, 2.9rem); color: var(--hmtc-deep-blue); margin: 0 0 .3rem; }
.hmtc-adv-intro { max-width: 700px; margin: 0 auto 1rem; color: var(--hmtc-ink); }
.hmtc-adv-statusline { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 12px; }
.hmtc-adv-chip { background: #eef4fc; border: 1px solid #dbe6f5; color: var(--hmtc-deep-blue); border-radius: 999px; padding: 6px 14px; font-size: .88rem; font-weight: 600; }
.hmtc-adv-chip--accent { background: var(--hmtc-red); color: #fff; border-color: var(--hmtc-red); }
.hmtc-adv-privacy { max-width: 700px; margin: 0 auto; background: #eef7ef; border: 1px solid #cfe6d3; color: #1c4c2f; border-radius: 12px; padding: 10px 14px; font-size: .88rem; }
.hmtc-adv-noscript { background: #fff3cd; border: 1px solid #ffe08a; padding: 10px 14px; border-radius: 10px; margin: 12px auto; max-width: 700px; }

/* ---- Email reminder sign-up ---- */
.hmtc-adv-notify { background: #fff; border: 1px solid rgba(11,30,63,.07); border-radius: var(--hmtc-radius); box-shadow: var(--hmtc-shadow-sm); padding: 22px; margin: 22px auto; }
.hmtc-adv-notify__intro { color: var(--hmtc-ink); max-width: 640px; }
.hmtc-adv-notify__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.hmtc-adv-notify__row .hmtc-field { flex: 1 1 200px; margin-bottom: 0; }
.hmtc-adv-notify__small { font-size: .82rem; color: var(--hmtc-muted); margin: 8px 0 0; }
.hmtc-adv-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.hmtc-adv-notice { border-radius: 10px; padding: 10px 14px; font-weight: 600; margin: 0 0 12px; }
.hmtc-adv-notice--ok { background: #eef7ef; border: 1px solid #cfe6d3; color: #1c4c2f; }
.hmtc-adv-notice--err { background: #fdecec; border: 1px solid #f4c6c6; color: #8a2a2a; }
@media (max-width: 480px) { .hmtc-adv-notify { padding: 16px; } }

/* ---- Mode selector ---- */
.hmtc-adv-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.hmtc-adv-mode { text-align: left; background: #f7faff; border: 2px solid #e2e9f4; border-radius: 14px; padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s ease, transform .12s ease; }
.hmtc-adv-mode:hover { transform: translateY(-2px); }
.hmtc-adv-mode.is-active { border-color: var(--hmtc-red); background: #fff5f5; }
.hmtc-adv-mode__name { font-weight: 800; color: var(--hmtc-deep-blue); }
.hmtc-adv-mode__desc { font-size: .85rem; color: var(--hmtc-muted); }
.hmtc-adv-toggles { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.hmtc-adv-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--hmtc-ink); cursor: pointer; }
.hmtc-adv-catchup-note { margin: 10px 0 0; font-weight: 600; color: var(--hmtc-red); }
.hmtc-adv-toggle--preview span { font-weight: 700; }
.hmtc-adv-preview-note { margin: 10px 0 0; background: #fff8ec; border: 1px solid #f2e2c2; border-left: 4px solid var(--hmtc-gold); border-radius: 10px; padding: 10px 12px; font-size: .88rem; color: #7a5a10; }

/* ---- Progress ---- */
.hmtc-adv-celebrate { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: linear-gradient(135deg, var(--hmtc-green), #14432e); color: #fff; border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.hmtc-adv-celebrate__icon { font-size: 2rem; }
.hmtc-adv-celebrate strong { font-size: 1.15rem; display: block; }
.hmtc-adv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hmtc-adv-stat { background: #f7faff; border: 1px solid #e2e9f4; border-radius: 12px; padding: 12px; text-align: center; }
.hmtc-adv-stat__v { display: block; font-size: 1.6rem; font-weight: 900; color: var(--hmtc-deep-blue); }
.hmtc-adv-stat__l { font-size: .76rem; color: var(--hmtc-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.hmtc-adv-progressbar-head { margin: 16px 0 4px; font-weight: 600; color: var(--hmtc-deep-blue); }
.hmtc-adv-bar { height: 18px; background: #e7edf6; border-radius: 999px; overflow: hidden; }
.hmtc-adv-bar__fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--hmtc-green), #2e9e5b); transition: width .5s ease; }
.hmtc-adv-encourage { color: var(--hmtc-muted); font-size: .9rem; margin: 10px 0 0; }

/* Light-string journey */
.hmtc-adv-lights { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding: 14px 6px 24px; border-top: 2px dashed #e2e9f4; }
.hmtc-adv-light { width: 14px; height: 14px; border-radius: 50%; background: #d7dfea; box-shadow: inset 0 -2px 3px rgba(0,0,0,.12); transition: background .3s ease, box-shadow .3s ease; }
.hmtc-adv-light.is-on { background: var(--hmtc-gold); box-shadow: 0 0 8px rgba(240,193,75,.9); animation: hmtc-adv-twinkle 3s ease-in-out infinite; }
.hmtc-adv-light:nth-child(3n).is-on { background: var(--hmtc-red); box-shadow: 0 0 8px rgba(198,40,40,.8); }
.hmtc-adv-light:nth-child(3n+1).is-on { background: #7ee0a4; box-shadow: 0 0 8px rgba(126,224,164,.8); }
@keyframes hmtc-adv-twinkle { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.hmtc-adv-sleigh { position: absolute; bottom: 0; left: 0; transform: translateX(-50%); font-size: 1.3rem; transition: left .6s ease; }

/* ---- Door grid ---- */
.hmtc-adv-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.hmtc-adv-cell { margin: 0; }
.hmtc-adv-door {
	position: relative; width: 100%; aspect-ratio: 1 / 1; min-height: 60px; border: 0; cursor: pointer; border-radius: 14px;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
	background: linear-gradient(160deg, #2a5a9c, #12315f); color: #fff; overflow: hidden;
	box-shadow: var(--hmtc-shadow-sm); transition: transform .15s ease, box-shadow .15s ease;
}
/* Height fallback for browsers without aspect-ratio support. */
@supports not (aspect-ratio: 1 / 1) { .hmtc-adv-door { height: 84px; } }
.hmtc-adv-door::before { content: ""; position: absolute; top: 0; left: 50%; width: 12px; height: 100%; transform: translateX(-50%); background: rgba(255,255,255,.14); }
.hmtc-adv-door::after { content: ""; position: absolute; top: 50%; left: 0; width: 100%; height: 12px; transform: translateY(-50%); background: rgba(255,255,255,.14); }
.hmtc-adv-door:hover { transform: translateY(-3px); box-shadow: var(--hmtc-shadow); }
.hmtc-adv-door__num { position: relative; z-index: 2; font-size: 1.5rem; font-weight: 900; }
.hmtc-adv-door__state { position: relative; z-index: 2; font-size: 1rem; }
.hmtc-adv-door__hint { position: relative; z-index: 2; font-size: .62rem; line-height: 1.1; padding: 0 4px; text-align: center; opacity: .9; max-height: 2.2em; overflow: hidden; }

.hmtc-adv-door.is-locked { background: linear-gradient(160deg, #6b7890, #47536a); color: #eef; cursor: not-allowed; opacity: .85; }
.hmtc-adv-door.is-available { background: linear-gradient(160deg, var(--hmtc-green), #14432e); }
.hmtc-adv-door.is-available::after { background: rgba(240,193,75,.4); }
.hmtc-adv-door.is-today { box-shadow: 0 0 0 3px var(--hmtc-gold), var(--hmtc-shadow); animation: hmtc-adv-bounce 2.4s ease-in-out infinite; }
.hmtc-adv-door.is-opened { background: linear-gradient(160deg, #b23636, var(--hmtc-red)); }
.hmtc-adv-door.is-opened::before, .hmtc-adv-door.is-opened::after { background: rgba(255,255,255,.22); }
.hmtc-adv-door.is-completed { box-shadow: 0 0 0 3px var(--hmtc-gold), var(--hmtc-shadow-sm); }
.hmtc-adv-door.is-completed .hmtc-adv-door__num::after { content: " ⭐"; }
@keyframes hmtc-adv-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* Catch-up highlight (does NOT hide doors) */
.hmtc-adv-door.is-catchup { outline: 3px dashed var(--hmtc-gold); outline-offset: 2px; }

/* Door-opening animation: Santa pops out and the door gives a happy wiggle */
.hmtc-adv-door__burst {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	font-size: 2rem; opacity: 0; pointer-events: none; z-index: 4;
	text-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.hmtc-adv-door.is-opening { animation: hmtc-adv-dooropen .62s ease; z-index: 5; }
.hmtc-adv-door.is-opening::before { animation: hmtc-adv-ribbon .62s ease forwards; }
.hmtc-adv-door.is-opening .hmtc-adv-door__num,
.hmtc-adv-door.is-opening .hmtc-adv-door__state,
.hmtc-adv-door.is-opening .hmtc-adv-door__hint { opacity: 0; transition: opacity .15s ease; }
.hmtc-adv-door.is-opening .hmtc-adv-door__burst { animation: hmtc-adv-pop .62s ease; }
@keyframes hmtc-adv-dooropen {
	0% { transform: none; }
	25% { transform: scale(.9) rotate(-3deg); }
	55% { transform: scale(1.08) rotate(2deg); }
	100% { transform: none; }
}
@keyframes hmtc-adv-ribbon { 0% { transform: translateX(-50%) scaleY(1); } 100% { transform: translateX(-50%) scaleY(0); } }
@keyframes hmtc-adv-pop {
	0% { opacity: 0; transform: translateY(10px) scale(.3); }
	45% { opacity: 1; transform: translateY(-6px) scale(1.15); }
	80% { opacity: 1; transform: translateY(-10px) scale(1); }
	100% { opacity: 0; transform: translateY(-18px) scale(.9); }
}

/* ---- Modal ---- */
.hmtc-adv-modal { border: 0; border-radius: 18px; padding: 0; max-width: 560px; width: calc(100% - 28px); box-shadow: 0 24px 70px rgba(11,30,63,.35); }
.hmtc-adv-modal::backdrop { background: rgba(11,30,63,.5); }
.hmtc-adv-modal__inner { padding: 22px; max-height: 86vh; overflow-y: auto; }
.hmtc-adv-modal__top { display: flex; align-items: center; justify-content: space-between; }
.hmtc-adv-modal__day { display: inline-block; background: var(--hmtc-red); color: #fff; font-weight: 800; border-radius: 999px; padding: 4px 14px; font-size: .9rem; }
.hmtc-adv-modal__close { background: #eef2f9; border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; color: var(--hmtc-deep-blue); }
.hmtc-adv-modal__title { color: var(--hmtc-deep-blue); font-size: 1.5rem; margin: 12px 0 6px; }
.hmtc-adv-modal__summary { color: var(--hmtc-ink); margin: 0 0 12px; }
.hmtc-adv-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 14px; }
.hmtc-adv-metachip { background: #f2f6fc; border: 1px solid #e2e9f4; border-radius: 999px; padding: 4px 12px; font-size: .82rem; color: var(--hmtc-deep-blue); font-weight: 600; }
.hmtc-adv-modal__section h4, .hmtc-adv-extra h4 { color: var(--hmtc-deep-blue); margin: 12px 0 6px; }
.hmtc-adv-instructions { margin: 0; padding-left: 20px; }
.hmtc-adv-instructions li { margin-bottom: 4px; }
.hmtc-adv-materials { background: #fff8ec; border-left: 4px solid var(--hmtc-gold); padding: 8px 12px; border-radius: 8px; font-size: .9rem; }
.hmtc-adv-safety { background: #fdf0f0; border-left: 4px solid var(--hmtc-red); padding: 8px 12px; border-radius: 8px; font-size: .88rem; color: #8a2a2a; }
.hmtc-adv-extra { background: #eef4fc; border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.hmtc-adv-extra h4 { margin-top: 0; }
.hmtc-adv-answer { font-weight: 700; color: var(--hmtc-green); }
.hmtc-adv-custom { margin-top: 12px; background: #f7faff; border: 1px solid #e2e9f4; border-radius: 12px; padding: 10px 14px; }
.hmtc-adv-custom summary { cursor: pointer; font-weight: 700; color: var(--hmtc-deep-blue); }
.hmtc-adv-custom__actions { display: flex; gap: 8px; }
.hmtc-adv-modal__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---- Tools ---- */
.hmtc-adv-tools__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

/* ---- CTA cards ---- */
.hmtc-adv-cta__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.hmtc-adv-cta__card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; background: #f7faff; border: 1px solid #e2e9f4; border-radius: 14px; padding: 16px; transition: transform .15s ease, box-shadow .15s ease; }
.hmtc-adv-cta__card:hover { transform: translateY(-3px); box-shadow: var(--hmtc-shadow); }
.hmtc-adv-cta__icon { font-size: 1.6rem; }
.hmtc-adv-cta__title { font-weight: 800; color: var(--hmtc-deep-blue); }
.hmtc-adv-cta__desc { font-size: .86rem; color: var(--hmtc-muted); }

/* ---- SEO ---- */
.hmtc-adv-seo { padding: 20px; }
.hmtc-adv-seo__block { margin-bottom: 26px; }
.hmtc-adv-seo__block h2 { color: var(--hmtc-deep-blue); }
.hmtc-adv-seo__cols { columns: 2; }
@media (max-width: 560px) { .hmtc-adv-seo__cols { columns: 1; } }

/* ---- Responsive ---- */
@media (max-width: 900px) { .hmtc-adv-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) {
	.hmtc-adv-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
	.hmtc-adv-door__num { font-size: 1.15rem; }
	.hmtc-adv-door__hint { display: none; }
	.hmtc-adv-stats { grid-template-columns: repeat(2, 1fr); }
	.hmtc-adv-controls, .hmtc-adv-progress, .hmtc-adv-gridwrap, .hmtc-adv-tools, .hmtc-adv-cta { padding: 16px; }
}
@media (max-width: 340px) { .hmtc-adv-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	.hmtc-adv-snip, .hmtc-adv-door, .hmtc-adv-light, .hmtc-adv-sleigh, .hmtc-adv-bar__fill { animation: none !important; transition: none !important; }
}
.hmtc-adv-reduced .hmtc-adv-snip,
.hmtc-adv-reduced .hmtc-adv-door.is-today,
.hmtc-adv-reduced .hmtc-adv-light.is-on { animation: none !important; }

/* ---- Print (page itself; primary printing uses a separate window) ---- */
@media print {
	.hmtc-header, .hmtc-footer, .hmtc-adv-controls, .hmtc-adv-tools, .hmtc-adv-modal, .hmtc-adv-cta, .hmtc-adv-header__deco { display: none !important; }
	.hmtc-advent, .hmtc-adv-gridwrap, .hmtc-adv-progress { box-shadow: none !important; border: none !important; }
}
