/* ============================================================
   Puglieser di Oggi — Fase Beta
   Estetica: Current Rothko (minimalismo editoriale, calore pugliese)
   ============================================================ */

/* --- Font: Fraunces (serif) + Inter (sans), self-hosted --- */
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/Fraunces-VariableFont.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-VariableFont.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Custom properties --- */
:root {
  --color-bg: #f4ede1;
  --color-text: #1a1a1a;
  --color-muted: #7a6f60;
  --color-accent: #b8412a;
  --color-line: rgba(26, 26, 26, .08);

  --font-serif: 'Fraunces', 'Söhne', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --space-xs: .5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 5rem;

  --radius: 2px;
  --transition: .35s cubic-bezier(.2, .8, .2, 1);
}

/* --- Reset essenziale --- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 3px; }

/* --- Stage (main content area) --- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-sm);
  padding-top: max(var(--space-md), env(safe-area-inset-top));
}

/* --- Loader --- */
.loader {
  display: flex;
  gap: 6px;
  align-items: center;
}
.loader span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-muted);
  animation: pulse 1.4s ease-in-out infinite;
}
.loader span:nth-child(2) { animation-delay: .2s; }
.loader span:nth-child(3) { animation-delay: .4s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: .2; transform: scale(.9); }
  40% { opacity: 1; transform: scale(1); }
}

/* --- Cover --- */
.cover {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  max-width: 560px;
  width: 100%;
  animation: cover-in .8s var(--transition);
}

@keyframes cover-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.cover__image-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: rgba(0, 0, 0, .03);
  box-shadow: 0 2px 40px rgba(0, 0, 0, .06),
              0 1px 3px rgba(0, 0, 0, .04);
}
.cover__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .3s;
}

.cover__meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.cover__date {
  font-family: var(--font-sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0;
}

.cover__title {
  font-family: var(--font-serif);
  font-weight: 380;
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -.015em;
  margin: 0;
  font-variation-settings: 'opsz' 32, 'SOFT' 30;
}

.cover__artist {
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 400;
  color: var(--color-muted);
  margin: 0;
  font-style: italic;
}

.cover__copy {
  font-family: var(--font-serif);
  font-weight: 380;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  margin: var(--space-sm) 0 0 0;
  font-variation-settings: 'opsz' 14;
  max-width: 42ch;
}

/* --- Actions --- */
.cover__actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  background: transparent;
  color: var(--color-text);
}
.btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn--primary {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}
.btn--primary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-bg);
}

.btn--hidden { display: none; }

/* --- Error --- */
.error {
  text-align: center;
  color: var(--color-muted);
}
.error p { margin: var(--space-xs) 0; }

/* --- Footer --- */
.footer {
  padding: var(--space-md) var(--space-sm);
  padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
  text-align: center;
  font-family: var(--font-sans);
  font-size: .75rem;
  letter-spacing: .05em;
  color: var(--color-muted);
}
.footer__brand {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
}
.footer__brand:hover { color: var(--color-accent); }
.footer__sep { margin: 0 var(--space-xs); }
.footer__tag { font-style: italic; }

/* --- Layout desktop --- */
@media (min-width: 900px) {
  .cover {
    grid-template-columns: 1fr 1fr;
    max-width: 1000px;
    gap: var(--space-xl);
    align-items: center;
  }
  .cover__image-wrap {
    aspect-ratio: 3 / 4;
  }
  .cover__title {
    font-size: clamp(2rem, 3vw, 2.75rem);
  }
}

/* --- Riduzione motion --- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001s !important;
    transition-duration: .001s !important;
  }
}
