:root {
  color-scheme: light;
  --ink: #17312f;
  --muted: #63736f;
  --paper: #fffaf0;
  --line: rgba(23, 49, 47, 0.13);
  --shadow: 0 16px 40px rgba(52, 65, 56, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 8%, rgba(242, 194, 74, 0.16), transparent 22rem),
    radial-gradient(circle at 96% 36%, rgba(93, 181, 162, 0.13), transparent 25rem),
    var(--paper);
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(23, 49, 47, 0.12) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
  content: "";
  opacity: 0.22;
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  border-radius: 0.65rem;
  color: white;
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 50% 44% 50% 42%;
  background: #f6c94f;
  transform: rotate(-5deg);
}

.brand-mark svg {
  width: 22px;
  fill: var(--ink);
}

.header-status {
  display: flex;
  gap: 1.4rem;
  align-items: center;
}

.weather {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  min-width: 132px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.45);
}

.weather-icon {
  width: 1.8rem;
  font-size: 1.5rem;
  line-height: 1;
  text-align: center;
}

.weather-copy,
.weather-copy strong,
.weather-copy span {
  display: block;
}

.weather-copy strong {
  font-size: 0.92rem;
  line-height: 1.1;
}

.weather-copy span {
  max-width: 118px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 600;
}

.today-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ee795d;
  box-shadow: 0 0 0 4px rgba(238, 121, 93, 0.14);
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: #b34c39;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

h2,
p {
  margin-top: 0;
}

.favorites,
.explore {
  padding: 4.5rem 0;
  border-top: 1px solid var(--line);
}

.favorites {
  padding-top: 3.5rem;
  border-top: 0;
}

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

.section-heading .eyebrow {
  margin-bottom: 0.45rem;
}

h2 {
  margin-bottom: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.section-hint {
  max-width: 340px;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.tile-grid {
  display: grid;
  gap: 1rem;
}

.featured-grid {
  grid-template-columns: repeat(6, 1fr);
}

.app-card {
  position: relative;
  display: flex;
  grid-column: span 2;
  min-height: 295px;
  padding: 1.35rem;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(23, 49, 47, 0.12);
  border-radius: 1.55rem;
  box-shadow: 0 5px 0 rgba(23, 49, 47, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

a.app-card:hover,
a.app-card:focus-visible {
  box-shadow: 0 10px 0 rgba(23, 49, 47, 0.12), var(--shadow);
  transform: translateY(-5px);
}

.app-card:focus-visible,
.mini-card:focus-visible,
.card-action:focus-visible,
.brand:focus-visible {
  outline: 4px solid #2e73d1;
  outline-offset: 4px;
}

.dreambox { background: #ffd562; }
.beast { background: #f3a68c; }
.chess { background: #a7d8ca; }
.makecode { background: #9cc0e8; }
.epic {
  background: #c9b7e6;
}

.stardew { background: #b8d77d; }

.has-actions { min-height: 325px; }

.card-topline {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category,
.app-badge {
  padding: 0.35rem 0.62rem;
  border: 1px solid rgba(23, 49, 47, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.app-badge {
  color: #fff;
  background: var(--ink);
}

.arrow {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(23, 49, 47, 0.22);
  border-radius: 50%;
  font-size: 1rem;
  transition: transform 180ms ease;
}

a:hover .arrow { transform: rotate(10deg) translate(2px, -2px); }

.app-icon {
  z-index: 1;
  display: grid;
  width: 74px;
  height: 74px;
  margin: 1.25rem 0 auto;
  place-items: center;
  border: 1px solid rgba(23, 49, 47, 0.15);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(-3deg);
}

.app-icon svg {
  width: 48px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-title {
  z-index: 1;
  display: block;
  margin-top: 1rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.card-description {
  z-index: 1;
  display: block;
  margin-top: 0.25rem;
  color: rgba(23, 49, 47, 0.7);
  font-size: 0.8rem;
}

.card-decoration {
  position: absolute;
  right: -8px;
  bottom: 66px;
  color: rgba(23, 49, 47, 0.08);
  font-family: "Fraunces", Georgia, serif;
  font-size: 3rem;
  font-weight: 700;
  transform: rotate(-9deg);
}

.pieces { font-size: 4.5rem; bottom: 55px; }
.pixel { font-size: 6rem; bottom: 40px; }

.epic-actions {
  z-index: 2;
  display: flex;
  gap: 0.55rem;
  margin-top: 1.15rem;
  flex-wrap: wrap;
}

.card-action {
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(23, 49, 47, 0.3);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.3);
  font-size: 0.74rem;
  font-weight: 700;
}

.card-action:hover { background: rgba(255, 255, 255, 0.55); }
.card-action.primary { color: white; background: var(--ink); }

.explore {
  padding-top: 4rem;
}

.section-heading.compact { margin-bottom: 1.5rem; }

.explore-grid {
  grid-template-columns: repeat(3, 1fr);
}

.mini-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  min-height: 104px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 4px 0 rgba(23, 49, 47, 0.08);
  transition: background 180ms ease, transform 180ms ease;
}

.mini-card:hover {
  background: white;
  transform: translateY(-3px);
}

.mini-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 1rem;
  font-size: 1.8rem;
  background: #f6c760;
}

.pbs .mini-icon { background: #9fd6c8; }
.music .mini-icon { color: white; background: #e78469; }
.phet .mini-icon { background: #b8d5f0; }
.nasa .mini-icon { background: #b9b3e1; }
.mathigon .mini-icon { color: white; background: #63ae9b; }

.mini-card strong,
.mini-card small { display: block; }
.mini-card strong { margin-bottom: 0.25rem; font-size: 0.95rem; }
.mini-card small { color: var(--muted); font-size: 0.72rem; }
.mini-card .arrow { width: 27px; height: 27px; font-size: 0.85rem; }

footer {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.footer-star + a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(99, 115, 111, 0.35);
  text-underline-offset: 0.2em;
}

.footer-star { color: #ed7459; }

@media (max-width: 900px) {
  .app-card { grid-column: span 3; }
  .explore-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .page-shell { width: min(100% - 24px, 520px); }
  .site-header { min-height: 76px; }
  .today { display: none; }
  .section-heading { display: block; }
  .section-hint { margin-top: 1rem; }
  .featured-grid { grid-template-columns: 1fr; }
  .app-card,
  .epic { grid-column: auto; }
  .favorites,
  .explore { padding: 3.5rem 0; }
}

@media (max-width: 420px) {
  .brand > span:last-child { display: none; }
  .weather { min-width: 125px; }
  footer { flex-wrap: wrap; padding: 1.5rem 0; }
}

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

@media (prefers-color-scheme: dark) {
  :root { color-scheme: light; }
}
