@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #0b2a20;
}

:root {
  --ink: #05080a;
  --paper: #e8efe9;
  --gray: #9aa5a0;
  --brush: 'Nanum Brush Script', 'Noto Serif KR', serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: 'Noto Serif KR', serif;
  overflow-x: hidden;
  transition: --accent 600ms ease;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 320px;
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 90% at 50% 15%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 70%),
    var(--ink);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    linear-gradient(#fff 1px, transparent 1px),
    linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 32px 32px;
}

/* All 15 tiles always fit one screen: 5x3 in landscape, 3x5 in portrait. */
.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.5vmin, 20px);
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: clamp(8px, 2vmin, 28px) clamp(8px, 2vmin, 28px) clamp(2px, 0.5vmin, 8px);
  list-style: none;
}

.grid > li { min-width: 0; min-height: 0; }

@media (max-aspect-ratio: 1/1) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
  }
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  container-type: size;
  width: 100%;
  height: 100%;
  padding: clamp(4px, 1vmin, 12px);
  overflow: hidden;
  text-align: center;
  text-decoration: none;
  color: inherit;
  background: rgba(5, 8, 10, 0.6);
  border: 1px solid rgba(232, 239, 233, 0.18);
  border-radius: 4px;
  outline: none;
  transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease, opacity 300ms ease;
}

.tile.is-soon { opacity: 0.55; cursor: default; }

.tile.is-active {
  opacity: 1;
  transform: translateY(-4px) scale(1.03);
  border-color: var(--tile-accent);
  box-shadow: 0 0 28px color-mix(in srgb, var(--tile-accent) 60%, transparent);
}

.tile:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }

.glyph {
  font-family: var(--brush);
  font-weight: 400;
  font-size: clamp(24px, min(38cqh, 50cqw), 9rem);
  line-height: 1;
  transition: transform 300ms ease, text-shadow 300ms ease;
}

.tile.is-active .glyph {
  transform: scale(1.18);
  text-shadow: 0 0 18px var(--tile-accent);
}

.icon {
  flex: none;
  width: min(52cqw, 40cqh);
  aspect-ratio: 1;
  background: var(--paper);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  transition: background-color 300ms ease, transform 300ms ease;
}

.tile.is-active .icon {
  background: color-mix(in srgb, var(--tile-accent) 45%, white);
  transform: scale(1.12);
}

.name {
  margin-top: 3cqh;
  font-weight: 700;
  font-size: clamp(10px, min(9cqh, 10cqw), 1.4rem);
  letter-spacing: 0.05em;
  color: var(--gray);
}
.desc {
  margin-top: 1cqh;
  font-family: var(--brush);
  font-size: clamp(12px, min(13cqh, 15cqw), 2rem);
  line-height: 1;
  color: var(--gray);
}
.glyph { color: var(--gray); }

.syl {
  font-family: var(--brush);
  font-weight: 400;
  font-size: 2.3em;
  line-height: 1;
  vertical-align: -0.15em;
  margin-right: 0.15em;
  text-shadow: 0 0 1px rgba(232, 239, 233, 0.9), 0 0 6px rgba(232, 239, 233, 0.55);
}

.ink {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}

.fallback {
  margin: 0;
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  opacity: 0.7;
  padding: 16px;
}
.grid:empty { display: none; }
.grid:not(:empty) + .fallback { display: none; }

.site-footer {
  flex: none;
  padding: clamp(4px, 1vmin, 10px) 16px clamp(6px, 1.4vmin, 14px);
  text-align: center;
  font-size: clamp(11px, 1.6vmin, 14px);
  letter-spacing: 0.05em;
  color: var(--gray);
}

@media (prefers-reduced-motion: reduce) {
  body, .tile, .glyph, .icon { transition: none; }
  .tile.is-active, .tile.is-active .glyph, .tile.is-active .icon { transform: none; }
}
