/* Favilla Studio — minimal personal landing + spark memory game
   Ember & Paper · Fraunces (display) + Inter (UI)
   Layout goal: fit comfortably in one viewport at 100% zoom (incl. OS display scaling). */

:root {
  --ember: #E8622C;
  --glow: #F4A93B;
  --red-ember: #D6452A;
  --amber: #F2C14E;
  --terracotta: #9E3B1F;
  --charcoal: #1F1A17;
  --paper: #F6EFE5;
  --ash: #8A817A;
  --line: #E2D6C4;

  --display: "Fraunces", Georgia, serif;
  --ui: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: hidden; }
h1, h2, p { overflow-wrap: break-word; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--ui);
  color: var(--charcoal);
  background: var(--paper);
  background-image:
    radial-gradient(900px 480px at 92% -10%, rgba(244,169,59,.16), transparent 60%),
    radial-gradient(700px 420px at -8% 110%, rgba(232,98,44,.08), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
svg { display: block; }

.page {
  min-height: 100dvh;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px clamp(20px, 4vw, 40px);
  display: flex;
  flex-direction: column;
}

/* ---------- brand row ---------- */
.brand { display: flex; align-items: center; }
.brand .logo { height: 30px; width: auto; }

/* ---------- main: two columns on desktop, vertically centered ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: clamp(28px, 5vh, 48px);
  padding: clamp(16px, 4vh, 40px) 0;
}

/* ---------- intro ---------- */
.intro h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(40px, 6.4vw, 66px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0;
}
.intro h1 .dot { color: var(--ember); }
.intro p {
  margin: 16px 0 0;
  font-size: clamp(15px, 1.6vw, 18px);
  color: #514a44;
  max-width: 34ch;
}
.intro .where { color: var(--ash); }

/* ---------- game ---------- */
.game {
  border: 1px solid var(--line);
  background: #FBF6EE;
  border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 26px);
  box-shadow: 0 1px 2px rgba(31,26,23,.05), 0 14px 40px rgba(31,26,23,.06);
}
.game-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.game-top h2 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0; }
.game-top .scores { font-size: 13px; color: var(--ash); font-variant-numeric: tabular-nums; }
.game-top .scores b { color: var(--charcoal); font-weight: 600; }
.game-hint { color: var(--ash); font-size: 14px; margin: 8px 0 16px; }

.pads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
.pad {
  appearance: none;
  border: none;
  cursor: pointer;
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--pad);
  opacity: .42;
  transition: opacity .18s ease, transform .12s ease, box-shadow .18s ease;
  min-height: 44px;
  position: relative;
  outline: none;
}
.pad::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(31,26,23,.06);
}
.pad:disabled { cursor: default; }
.pad.lit {
  opacity: 1;
  transform: scale(1.03);
  box-shadow: 0 0 0 4px rgba(244,169,59,.30), 0 10px 30px rgba(232,98,44,.30);
}
.pad:not(:disabled):hover { opacity: .62; }
.pad:focus-visible { box-shadow: 0 0 0 4px var(--charcoal); opacity: .7; }
.pad[data-c="0"] { --pad: var(--ember); }
.pad[data-c="1"] { --pad: var(--amber); }
.pad[data-c="2"] { --pad: var(--red-ember); }
.pad[data-c="3"] { --pad: var(--glow); }

.game-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 15px;
  padding: 11px 22px;
  min-height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--ember);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.btn:hover { background: var(--terracotta); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }

.status { font-size: 14px; color: #514a44; min-height: 20px; }
.status b { color: var(--ember); }

.sound-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ash);
  background: none;
  border: none;
  cursor: pointer;
  min-height: 44px;
  padding: 0 4px;
}
.sound-toggle svg { width: 18px; height: 18px; }
.sound-toggle:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; border-radius: 8px; }

/* ---------- footer ---------- */
footer { color: var(--ash); font-size: 12.5px; padding-top: 8px; }

/* ---------- desktop: side-by-side, fits one viewport ---------- */
@media (min-width: 820px) {
  .layout {
    grid-template-columns: 1fr minmax(330px, 380px);
    align-items: center;
    gap: clamp(40px, 6vw, 80px);
  }
  .intro p { margin-top: 20px; }
}

@media (max-width: 480px) {
  .sound-toggle { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .pad.lit { transform: none; }
}
