:root {
  color-scheme: dark;
  --sky-top: #70869b;
  --sky-bottom: #e6caa1;
  --ink: #f7f3e8;
  --muted: #c9c6bc;
  --panel: rgba(15, 20, 27, 0.72);
  --panel-strong: rgba(12, 16, 22, 0.9);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #e4bd71;
  --accent-glow: rgba(228, 189, 113, 0.2);
  --mistress: #ff63b7;
  --shadow: rgba(0, 0, 0, 0.42);
  --orb-x: 72%;
  --orb-y: 18%;
  font-family: "Segoe UI", Arial, system-ui, sans-serif;
}

html[data-theme="day"] {
  color-scheme: light;
  --sky-top: #4f96c7;
  --sky-bottom: #d7e8e7;
  --ink: #17212d;
  --muted: #53606b;
  --panel: rgba(244, 247, 246, 0.79);
  --panel-strong: rgba(247, 249, 247, 0.92);
  --line: rgba(23, 33, 45, 0.14);
  --accent: #95601d;
  --accent-glow: rgba(184, 119, 37, 0.16);
  --shadow: rgba(15, 31, 42, 0.2);
  --orb-x: 78%;
  --orb-y: 13%;
}

html[data-theme="sunset"] {
  --sky-top: #3a2e54;
  --sky-bottom: #d06e4f;
  --ink: #fff4e7;
  --muted: #e2c6b8;
  --panel: rgba(35, 23, 36, 0.75);
  --panel-strong: rgba(31, 19, 32, 0.91);
  --line: rgba(255, 231, 216, 0.18);
  --accent: #ffb159;
  --accent-glow: rgba(255, 134, 67, 0.24);
  --orb-x: 76%;
  --orb-y: 38%;
}

html[data-theme="night"] {
  --sky-top: #050812;
  --sky-bottom: #171725;
  --ink: #f6eee1;
  --muted: #aaa6a2;
  --panel: rgba(9, 10, 17, 0.79);
  --panel-strong: rgba(8, 9, 15, 0.94);
  --line: rgba(255, 218, 173, 0.13);
  --accent: #f1a74e;
  --accent-glow: rgba(255, 135, 39, 0.24);
  --shadow: rgba(0, 0, 0, 0.62);
  --orb-x: 77%;
  --orb-y: 12%;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  transition: color .8s ease, background 1.2s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 24%, rgba(255,255,255,.08), transparent 22%),
    linear-gradient(90deg, rgba(0,0,0,.13), transparent 28%, transparent 72%, rgba(0,0,0,.13));
  z-index: -1;
}

.sky { position: fixed; inset: 0; overflow: hidden; z-index: -2; }
.sun, .moon {
  position: absolute;
  left: var(--orb-x);
  top: var(--orb-y);
  width: clamp(4rem, 8vw, 7rem);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: opacity .8s ease, left 1.2s ease, top 1.2s ease;
}
.sun { background: #ffe09b; box-shadow: 0 0 70px 28px rgba(255, 197, 107, .38); }
.moon { opacity: 0; background: #d8dbe2; box-shadow: 0 0 38px 10px rgba(194, 204, 229, .17); }
.stars { position: absolute; inset: 0; opacity: 0; transition: opacity 1s ease; }
.stars::before, .stars::after {
  content: ""; position: absolute; inset: 3% 4% 45%;
  background-image:
    radial-gradient(circle, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255,255,255,.7) 0 1px, transparent 1.4px);
  background-size: 97px 83px, 141px 121px;
  background-position: 8px 19px, 49px 7px;
}
.stars::after { transform: translate(37px, 24px) scale(.75); opacity: .55; }
.horizon { position: absolute; left: -5%; right: -5%; bottom: -2rem; clip-path: polygon(0 60%, 8% 38%, 16% 56%, 26% 24%, 37% 50%, 48% 17%, 59% 47%, 69% 30%, 80% 55%, 90% 29%, 100% 52%, 100% 100%, 0 100%); }
.horizon-back { height: 30vh; background: rgba(20, 29, 39, .24); }
.horizon-front { height: 21vh; background: rgba(8, 13, 20, .54); transform: scaleX(-1); }

.torch { display: none; position: fixed; top: 30vh; width: 12px; height: 38vh; background: linear-gradient(90deg, #2c170c, #704025 45%, #251006); box-shadow: 0 16px 30px rgba(0,0,0,.5); }
.torch-left { left: 4vw; transform: rotate(2deg); }
.torch-right { right: 4vw; transform: rotate(-2deg); }
.torch i, .torch i::before, .torch i::after { position: absolute; content: ""; display: block; left: 50%; border-radius: 48% 52% 46% 54%; transform: translateX(-50%); }
.torch i { bottom: calc(100% - 4px); width: 34px; height: 62px; background: #ffb341; filter: drop-shadow(0 0 22px #ff7b21); animation: flame 1.15s ease-in-out infinite alternate; }
.torch i::before { bottom: 5px; width: 21px; height: 43px; background: #ff6f23; }
.torch i::after { bottom: 4px; width: 9px; height: 27px; background: #fff0a8; }
@keyframes flame { from { transform: translateX(-50%) rotate(-3deg) scale(.93, 1); } to { transform: translateX(-50%) rotate(4deg) scale(1.08, .9); } }

html[data-theme="night"] .sun { opacity: 0; }
html[data-theme="night"] .moon, html[data-theme="night"] .stars { opacity: 1; }
html[data-theme="night"] .torch { display: block; }

.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.masthead { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid var(--accent); border-radius: 50%; font: 800 .7rem/1 "Arial Black", "Segoe UI", sans-serif; letter-spacing: .05em; box-shadow: inset 0 0 0 4px var(--accent-glow); }
.brand-name { font-weight: 700; letter-spacing: -.02em; }
.time-state { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; }
.time-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
#local-time { font-variant-numeric: tabular-nums; color: var(--ink); padding-left: 4px; }

.hero { min-height: 48vh; display: flex; flex-direction: column; justify-content: center; padding: 6rem 0 5rem; }
.eyebrow { margin: 0 0 1rem; color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; font-weight: 700; }
h1, h2 { font-family: "Arial Black", "Segoe UI", sans-serif; margin: 0; letter-spacing: -.055em; }
h1 { max-width: 900px; font-size: clamp(4rem, 13vw, 9.5rem); line-height: .86; text-shadow: 0 10px 45px var(--shadow); }
h1::after { content: "."; color: var(--accent); }
.hero-copy { max-width: 600px; margin: 2rem 0 0; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.6; }

.foundry-section, .calendar-section { margin-bottom: 6rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.9rem, 5vw, 3.5rem); line-height: 1.1; }
.foundry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.foundry-card { position: relative; display: flex; align-items: center; gap: 18px; min-height: 145px; padding: 24px; border: 1px solid var(--line); color: inherit; text-decoration: none; background: var(--panel); backdrop-filter: blur(15px); overflow: hidden; transition: transform .25s ease, border-color .25s ease, background .25s ease; }
.foundry-card::before { content: ""; position: absolute; inset: auto -15% -80% 20%; height: 150%; background: radial-gradient(circle, var(--accent-glow), transparent 64%); }
.foundry-card:hover { transform: translateY(-4px); border-color: var(--accent); background: var(--panel-strong); }
.mistress-card { --accent: var(--mistress); --accent-glow: rgba(255, 99, 183, .22); }
.foundry-seal { flex: 0 0 auto; display: grid; place-items: center; width: 76px; height: 76px; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent); font: 800 2rem/1 "Arial Black", "Segoe UI", sans-serif; box-shadow: inset 0 0 0 6px var(--accent-glow), 0 0 30px var(--accent-glow); }
.foundry-text { position: relative; display: grid; gap: 7px; }
.foundry-text strong { font: 800 clamp(1.25rem, 3vw, 1.85rem)/1 "Arial Black", "Segoe UI", sans-serif; letter-spacing: -.04em; }
.foundry-text small { color: var(--muted); font-size: .85rem; }
.open-icon { position: absolute; top: 22px; right: 24px; color: var(--accent); font-size: 1.4rem; }

.calendar-section { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(420px, 1.2fr); gap: clamp(28px, 6vw, 80px); align-items: start; padding: clamp(26px, 5vw, 56px); background: var(--panel-strong); border: 1px solid var(--line); backdrop-filter: blur(18px); box-shadow: 0 26px 80px var(--shadow); }
.calendar-intro p:last-child { max-width: 420px; color: var(--muted); line-height: 1.65; }
.event-list { border-top: 1px solid var(--line); }
.event { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.event-date { display: grid; justify-items: center; border-right: 1px solid var(--line); }
.event-date strong { font: 800 2rem/1 "Arial Black", "Segoe UI", sans-serif; color: var(--accent); }
.event-date span { margin-top: 7px; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; }
.event-info { min-width: 0; }
.event-info strong { display: block; font-size: 1.05rem; }
.event-info span { display: block; margin-top: 5px; color: var(--muted); font-size: .84rem; }
.event-badge { justify-self: end; padding: 6px 9px; border: 1px solid var(--line); color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }

footer { display: flex; justify-content: space-between; gap: 16px; padding: 28px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }

@media (max-width: 760px) {
  .shell { width: min(calc(100% - 28px), 1120px); }
  .masthead { min-height: 74px; }
  .brand-name { display: none; }
  .time-state { gap: 7px; }
  #theme-label { display: none; }
  .hero { min-height: 43vh; padding: 5rem 0 4rem; }
  h1 { font-size: clamp(3.5rem, 21vw, 6rem); }
  .foundry-section, .calendar-section { margin-bottom: 4rem; }
  .foundry-grid { grid-template-columns: 1fr; }
  .foundry-card { min-height: 120px; }
  .calendar-section { grid-template-columns: 1fr; padding: 24px; }
  .event { grid-template-columns: 62px 1fr; gap: 14px; }
  .event-badge { grid-column: 2; justify-self: start; }
  .torch { opacity: .55; }
  footer { flex-direction: column; }
}

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