/* ============================================
   Stardew Proxy — Pixel UI (Stardew Valley style)
   Font: Pixelify Sans (display + body)
   Palette: peach panel, wooden borders, orange buttons
   ============================================ */

:root {
  /* === Palette === */
  --peach:       #f4d4a0;
  --peach-light: #fae6c0;
  --peach-deep:  #e8c878;
  --wood:        #5a3a1a;
  --wood-dark:   #3d2610;
  --wood-light:  #8b5a2b;
  --ink:         #2a1a0a;
  --ink-light:   #4a3a20;
  --orange:      #e8821c;
  --orange-dark: #c4640c;
  --orange-light:#f0a040;
  --moss:        #4a7c4f;
  --moss-dark:   #2d5332;
  --wheat:       #d4a73c;
  --sky:         #7ab4d8;
  --cream:       #f9f0e0;
  --green-ok:    #5a9d4f;
  --green-dark:  #2d6322;

  /* === Type === */
  --font-pixel: 'Pixelify Sans', 'Victor Mono', monospace;

  /* === Spacing === */
  --sp-xs: 0.5rem;
  --sp-sm: 1rem;
  --sp-md: 1.5rem;
  --sp-lg: 2.5rem;
  --sp-xl: 4rem;
  --sp-2xl: clamp(4rem, 8vw, 7rem);

  /* === Radii (sharp!) === */
  --r-sm: 2px;
  --r-md: 4px;

  /* === Motion === */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 200ms;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  min-height: 100vh;
  image-rendering: pixelated;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 {
  font-family: var(--font-pixel);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; }
a { color: var(--orange-dark); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }

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

::selection {
  background: var(--orange);
  color: var(--ink);
}

/* ============================================
   Animated background (kept from before)
   ============================================ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-image: url("../img/bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  filter: saturate(0.85);
  will-change: transform;
  animation: bgDrift 60s var(--ease) infinite alternate;
}
body::after {
  content: none;
}
@keyframes bgDrift {
  0%   { transform: scale(1) translate3d(0, 0, 0); }
  100% { transform: scale(1.06) translate3d(-2.5%, -1.5%, 0); }
}

/* ============================================
   Panel (wooden-bordered box, Stardew UI style)
   ============================================ */
.sdv-panel {
  position: relative;
  background: var(--peach);
  border: 4px solid var(--wood);
  box-shadow:
    inset 0 0 0 2px var(--peach-deep),
    0 4px 0 0 var(--wood-dark),
    0 6px 12px rgba(0, 0, 0, 0.25);
  padding: var(--sp-md);
  z-index: 1;
}

/* ============================================
   Topbar
   ============================================ */
.sdv-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem clamp(1rem, 5vw, 3rem);
  background: var(--wood-dark);
  border-bottom: 4px solid var(--wood);
  box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.3);
}
.sdv-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--cream);
}
.sdv-brand-icon svg,
.sdv-brand-icon img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 6px;
}
.sdv-brand-icon img {
  width: 36px;
  height: 36px;
  object-fit: cover;
}
.sdv-brand-text {
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: var(--peach-light);
  text-shadow: 2px 2px 0 var(--wood-dark);
}
.sdv-topbar-link {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--peach-light);
  padding: 0.5rem 1rem;
  background: var(--orange);
  border: 3px solid var(--wood);
  box-shadow: 0 3px 0 0 var(--wood-dark);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.sdv-topbar-link:hover {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 var(--wood-dark);
}
.sdv-topbar-link:active {
  transform: translateY(3px);
  box-shadow: none;
}

/* ============================================
   Hero
   ============================================ */
main {
  position: relative;
  z-index: 1;
}

.sdv-hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--sp-md);
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 5vw, 3rem) var(--sp-xl);
  max-width: 1200px;
  margin: 0 auto;
  align-items: center;
  min-height: min(70vh, 560px);
}

.sdv-hero-panel {
  padding: var(--sp-lg);
}

.sdv-title {
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--peach-deep);
  margin-bottom: var(--sp-sm);
}
.sdv-title em {
  font-style: normal;
  color: var(--orange-dark);
  text-shadow: 2px 2px 0 var(--peach-deep);
}
.sdv-title .exclaim {
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--peach-deep);
}

.sdv-lead {
  font-size: 1.1rem;
  color: var(--ink-light);
  max-width: 30rem;
  margin-bottom: var(--sp-lg);
  line-height: 1.65;
  text-wrap: pretty;
}

/* === Download box === */
.sdv-download-box {
  margin-top: var(--sp-md);
}

.platform-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: var(--sp-sm);
}

/* === Stardew button (square, orange, 3D press) === */
.sdv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  background: var(--orange);
  color: var(--ink);
  border: 3px solid var(--wood);
  font-family: var(--font-pixel);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 0 0 var(--wood-dark);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sdv-btn:hover {
  background: var(--orange-light);
  transform: translateY(1px);
  box-shadow: 0 3px 0 0 var(--wood-dark);
}
.sdv-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 0 var(--wood-dark);
}

.platform-pill[aria-selected="true"] {
  background: var(--moss);
  color: var(--cream);
  border-color: var(--wood-dark);
  box-shadow: 0 4px 0 0 var(--moss-dark);
}
.platform-pill[aria-selected="true"]:hover {
  background: #5a8c5f;
}

/* === Sub-choice (build + format selectors) === */
.subchoice {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height var(--dur) var(--ease), opacity var(--dur) var(--ease), margin var(--dur) var(--ease);
  margin-top: 0;
}
.subchoice.is-open {
  max-height: 400px;
  opacity: 1;
  margin-top: var(--sp-sm);
}
.subchoice-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 0.5rem;
  display: block;
}
.subchoice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.subchoice-row:last-child { margin-bottom: 0; }

.build-pill[aria-selected="true"] {
  background: var(--wood);
  color: var(--peach-light);
  border-color: var(--wood-dark);
  box-shadow: 0 4px 0 0 #1a0f08;
}
.build-pill[aria-pressed="true"] {
  background: var(--wood);
  color: var(--peach-light);
  border-color: var(--wood-dark);
  box-shadow: 0 4px 0 0 #1a0f08;
}
.format-pill[aria-pressed="true"] {
  background: var(--sky);
  color: var(--ink);
  border-color: var(--wood);
  box-shadow: 0 4px 0 0 #2a5070;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  background: var(--wheat);
  color: var(--ink);
  border: 3px solid var(--wood);
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 0 var(--wood-dark), 0 0 12px rgba(212, 167, 60, 0.4);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.download-btn:hover {
  transform: translateY(2px);
  box-shadow: 0 2px 0 0 var(--wood-dark), 0 0 16px rgba(212, 167, 60, 0.6);
  background: #e6b84a;
}
.download-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 0 var(--wood-dark);
}

.sdv-footnote {
  margin-top: var(--sp-sm);
  font-size: 0.85rem;
  color: var(--ink-light);
}

/* === Hero art === */
.sdv-hero-art {
  display: flex;
  justify-content: center;
  align-items: center;
}
.sdv-hero-frame {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  background: var(--sky);
}
.hero-png, .hero-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   Section
   ============================================ */
.sdv-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 5vw, 3rem) var(--sp-lg);
}
.sdv-section > .sdv-panel {
  padding: var(--sp-xl) var(--sp-lg);
}
.sdv-section-title {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--peach-deep);
  margin-bottom: var(--sp-md);
}

/* === Feature grid === */
.sdv-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-md);
}
.sdv-feature {
  padding: var(--sp-md);
  background: var(--peach-light);
  border: 3px solid var(--wood);
  box-shadow: 0 4px 0 0 var(--wood-dark), inset 0 0 0 2px var(--peach-deep);
  text-align: left;
}
.sdv-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-sm);
}
.sdv-feature-icon svg {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.sdv-feature:first-child .sdv-feature-icon {
  color: var(--orange);
}
.sdv-feature:nth-child(2) .sdv-feature-icon {
  color: var(--moss);
}
.sdv-feature:nth-child(3) .sdv-feature-icon {
  color: var(--sky);
}
.sdv-feature h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.3rem;
  text-shadow: 1px 1px 0 var(--peach-deep);
}
.sdv-feature p {
  font-size: 0.95rem;
  color: var(--ink-light);
  line-height: 1.55;
  text-wrap: pretty;
}

/* === Trust === */
.sdv-trust-lead {
  font-size: 1.1rem;
  color: var(--ink);
  max-width: 38rem;
  line-height: 1.65;
  text-wrap: pretty;
}
.sdv-link {
  display: inline-block;
  margin-top: var(--sp-md);
  font-weight: 700;
  color: var(--orange-dark);
  text-decoration: none;
  border-bottom: 3px solid var(--wheat);
  padding-bottom: 2px;
  transition: color var(--dur) var(--ease);
}
.sdv-link:hover { color: var(--ink); }

/* === Community === */
.sdv-community-panel {
  text-align: center;
  padding: var(--sp-xl) var(--sp-lg);
}
.sdv-community-panel > .sdv-section-title {
  text-align: center;
}
.sdv-community-sub {
  font-size: 1.1rem;
  color: var(--ink-light);
  margin: var(--sp-sm) auto var(--sp-lg);
  max-width: 28rem;
  text-wrap: pretty;
}
.sdv-btn-primary {
  font-size: 1.1rem;
  padding: 0.9rem 2rem;
  background: var(--moss);
  color: var(--cream);
  border-color: var(--wood-dark);
  box-shadow: 0 4px 0 0 var(--moss-dark);
}
.sdv-btn-primary:hover {
  background: #5a8c5f;
  box-shadow: 0 3px 0 0 var(--moss-dark);
}

/* === Footer === */
.sdv-footer {
  position: relative;
  z-index: 1;
  background: var(--wood-dark);
  padding: var(--sp-lg) clamp(1rem, 5vw, 3rem) var(--sp-md);
  margin-top: var(--sp-xl);
}
.sdv-footer-inner {
  background: transparent;
  border: none;
  box-shadow: none;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm) var(--sp-lg);
  justify-content: space-between;
}
.sdv-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.sdv-footer-name {
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--peach-light);
}
.sdv-footer-line {
  font-size: 0.85rem;
  color: var(--peach-deep);
  flex: 1 1 20rem;
  max-width: 40rem;
}
.sdv-footer-links {
  display: flex;
  gap: var(--sp-md);
  flex-wrap: wrap;
}
.sdv-footer-links a {
  color: var(--peach-light);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color var(--dur) var(--ease);
}
.sdv-footer-links a:hover { color: var(--orange-light); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 840px) {
  .sdv-hero {
    grid-template-columns: 1fr;
    gap: var(--sp-md);
    min-height: auto;
    text-align: left;
  }
  .sdv-hero-art { order: -1; }
  .sdv-hero-frame { max-width: 320px; margin: 0 auto; }
  .sdv-title { font-size: clamp(1.5rem, 6vw, 2.25rem); }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .platform-row { flex-direction: column; align-items: stretch; }
  .sdv-btn { justify-content: center; }
  .sdv-topbar-link { padding: 0.4rem 0.8rem; font-size: 0.82rem; }
  .sdv-brand-text { font-size: 1.1rem; }
  .sdv-footer-inner { flex-direction: column; align-items: flex-start; }
  .sdv-section > .sdv-panel { padding: var(--sp-md); }
  .sdv-hero-panel { padding: var(--sp-md); }
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  body::before { animation: none; transform: scale(1.02); opacity: 0.80; }
}
