/* Faro Nazionale: coastal beacon, dispatch typography. Full-bleed images, no cards. */

:root {
  --bg: #FAFBFC;
  --navy: #1B3A5C;
  --navy-soft: rgba(27, 58, 92, 0.78);
  --hairline: rgba(27, 58, 92, 0.16);
  --scrim: 5, 14, 25;

  --amber: #D9A441;
  --rust: #C1633D;
  --teal: #3E7C8C;
  /* Darker shades of the same hues, used only for small text on white (contrast). */
  --amber-ink: #94690F;
  --rust-ink: #B0562F;
  --teal-ink: #3E7C8C;

  /* Masthead colors measured from logo.png */
  --logo-navy: #032341;
  --logo-gold-a: #985D08;
  --logo-gold-b: #AA6A09;
  --logo-gold-c: #9D6109;
  --logo-sea: #104161;
  --logo-rule-gold: #96631A;

  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-body: "Literata", Georgia, "Times New Roman", serif;
  /* Closest Google Font to the logo wordmark: Playfair, semi-condensed, optical size 72. */
  --font-mast: "Playfair", "Times New Roman", serif;

  --gutter: 16px;
  --col: 640px;
  --shot-ratio: 4 / 5;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.sec-politica { --accent: var(--amber); --accent-ink: var(--amber-ink); }
.sec-business { --accent: var(--rust); --accent-ink: var(--rust-ink); }
.sec-sport { --accent: var(--teal); --accent-ink: var(--teal-ink); }

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

html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-behavior: smooth; }
html.reader-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.page { max-width: var(--col); margin: 0 auto; overflow-x: clip; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.reader:focus { outline: none; }

/* ---------- Masthead ---------- */

.mast {
  position: relative;
  padding: calc(env(safe-area-inset-top, 0px) + 44px) var(--gutter) 28px;
  overflow: hidden;
}

.mast-beam {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(217, 164, 65, 0) 18%, rgba(217, 164, 65, 0.2) 52%, rgba(217, 164, 65, 0) 100%);
  clip-path: polygon(6% 46%, 100% 6%, 100% 74%);
  animation: beam-breathe 6s ease-in-out infinite;
  pointer-events: none;
}

.wordmark {
  position: relative;
  margin: 0;
  font-family: var(--font-mast);
  font-size: clamp(2.6rem, 14vw, 4.8rem);
  font-stretch: semi-condensed;
  word-spacing: -0.1em;
  line-height: 1;
  white-space: nowrap;
}

.wm-faro { font-weight: 900; letter-spacing: -0.03em; color: var(--logo-navy); }

.wm-nazionale {
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--logo-gold-b);
  background: linear-gradient(95deg, var(--logo-gold-a), var(--logo-gold-b) 55%, var(--logo-gold-c));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mast-rule {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  height: 4px;
}

.rule-sea {
  flex: 0 0 43%;
  height: 100%;
  background: linear-gradient(90deg, var(--logo-sea) 70%, rgba(16, 65, 97, 0));
  clip-path: polygon(0 0, 100% 42%, 100% 58%, 0 100%);
}

.rule-gold {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(150, 99, 26, 0.35), var(--logo-rule-gold));
}

.tagline {
  position: relative;
  margin: 18px 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy-soft);
}

.dial-nav {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.dial-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dial-nav a::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Section headings ---------- */

.sec { padding-top: 56px; }

.sec-head { padding: 0 var(--gutter) 22px; }

.sec-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sec-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 8.6vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.sec-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
}

.sec-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: beacon 2.6s ease-in-out infinite;
}

/* Radio-dial ruler: ticks and a needle. Decorative only. */
.dial {
  position: relative;
  height: 14px;
  margin-top: 14px;
  color: var(--navy);
  background:
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 40px) left bottom / 100% 14px no-repeat,
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 8px) left bottom / 100% 6px no-repeat;
  opacity: 0.55;
}

.dial::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 20px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}

.sec-politica .dial::after { left: 31%; }
.sec-business .dial::after { left: 58%; }
.sec-sport .dial::after { left: 79%; }

/* ---------- Story: full-bleed image, scrim, overlaid headline ---------- */

.story { margin: 0 0 56px; }
.story:last-child { margin-bottom: 8px; }

.story-link { display: block; }

.shot {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: var(--shot-ratio);
  max-height: 82vh;
  overflow: hidden;
  background: #0d2138;
}

.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out);
}

.story-link:hover .shot img { transform: scale(1.03); }

.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 84px var(--gutter) 22px;
  background: linear-gradient(
    to top,
    rgba(var(--scrim), 0.96) 0%,
    rgba(var(--scrim), 0.92) 42%,
    rgba(var(--scrim), 0.78) 66%,
    rgba(var(--scrim), 0) 100%
  );
}

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(var(--scrim), 0.9);
}

.kicker::before, .kicker::after { content: none; width: 22px; height: 2px; background: var(--accent); }

.headline {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.02rem, 4.9vw, 1.3rem);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.015em;
  color: #fff;
  text-wrap: balance;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 12px rgba(var(--scrim), 0.6);
}

.dispatch { padding: 18px var(--gutter) 0; }

.preview {
  margin: 0 0 14px;
  max-width: 34rem;
  font-size: 1.02rem;
  line-height: 1.62;
  hyphens: manual;
}

.em {
  font-weight: 700;
  color: var(--accent-ink);
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 20%, transparent) 62%);
}

.more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
  transition: gap 220ms var(--ease-out);
}

.story-link:hover .more { gap: 14px; }

/* Alternating alignment: odd left, even right, restarting per section. */
.is-left .overlay, .is-left .dispatch { text-align: left; }
.is-left .kicker { justify-content: flex-start; }
.is-left .kicker::before { content: ""; }

.is-right .overlay, .is-right .dispatch { text-align: right; }
.is-right .kicker { justify-content: flex-end; }
.is-right .kicker::after { content: ""; }
.is-right .preview { margin-left: auto; }

/* ---------- Footer ---------- */

.foot {
  margin-top: 64px;
  padding: 28px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 40px);
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
}

.foot-name { margin: 0 0 6px; font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; }
.foot-mail { display: inline-block; min-height: 32px; font-size: 0.8rem; color: var(--navy-soft); border-bottom: 1px solid var(--hairline); }

/* ---------- Reader (full article) ---------- */

.reader {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  overflow-x: clip;
  overscroll-behavior: contain;
  background: var(--bg);
  animation: reader-in 320ms var(--ease-out) both;
}

.reader-inner { max-width: var(--col); margin: 0 auto; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 56px); }

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) var(--gutter) 6px;
  background: rgba(250, 251, 252, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.reader-section {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.reader-head { position: relative; padding: 40px var(--gutter) 30px; overflow: hidden; }

.signal {
  position: absolute;
  left: -40px;
  top: -20px;
  width: 130%;
  height: 100%;
  min-height: 260px;
  color: var(--accent);
  pointer-events: none;
  animation: signal-in 1.2s ease-out both;
}

.signal .beam { fill: currentColor; opacity: 0.16; }
.signal .ring { fill: none; stroke: currentColor; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; opacity: 0.32; }
.signal .ring.r1 { animation: ring-pulse 3.2s ease-out 2 both; }
.signal .ring.r2 { animation: ring-pulse 3.2s ease-out 0.5s 2 both; }
.signal .ring.r3 { animation: ring-pulse 3.2s ease-out 1s 2 both; }
.signal .ring.r4 { animation: ring-pulse 3.2s ease-out 1.5s 2 both; }

.reader-head .kicker { position: relative; color: var(--accent-ink); }
.reader-head .kicker::before { content: ""; background: var(--accent); }

.reader-title {
  position: relative;
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.3rem, 6.2vw, 1.8rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.reader-shot { margin: 0; aspect-ratio: 4 / 3; max-height: 60vh; position: relative; overflow: hidden; background: #0d2138; }
.reader-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.reader-body { padding: 30px var(--gutter) 0; }
.reader-body p { margin: 0 0 1.25em; max-width: 38rem; font-size: 1.06rem; line-height: 1.75; hyphens: manual; text-wrap: pretty; }

/* Transmission stamp: telegraph / mail cancellation mark closing every dispatch. */
.stamp-row { display: flex; align-items: center; gap: 18px; padding: 14px var(--gutter) 8px; overflow-x: clip; }
.stamp-row.is-right { flex-direction: row-reverse; }

.stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px 9px;
  border: 4px double var(--accent);
  border-radius: 3px;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  text-transform: uppercase;
  --tilt: -5deg;
  transform: rotate(var(--tilt));
  filter: url(#stamp-ink);
  opacity: 0.94;
  mix-blend-mode: multiply;
  animation: stamp-in 520ms var(--ease-out) 0.25s both;
}

.stamp-top { font-size: 0.56rem; font-weight: 700; letter-spacing: 0.34em; }
.stamp-word { font-size: 1.45rem; font-weight: 800; letter-spacing: 0.14em; line-height: 1.1; }
.stamp-ticks { width: 100%; height: 5px; margin-top: 3px; background: repeating-linear-gradient(90deg, var(--accent) 0 2px, transparent 2px 5px); }

.stamp-row.is-right .stamp { --tilt: 4deg; }

.cancel { flex: 1; height: 34px; color: var(--accent); opacity: 0.55; min-width: 0; }
.cancel path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.reader-end { padding: 22px var(--gutter) 0; }
.reader-end .back { border-bottom: 2px solid var(--accent); padding-bottom: 2px; min-height: 44px; }

/* ---------- Motion ---------- */

@keyframes reader-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes signal-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ring-pulse { 0% { transform: scale(0.5); opacity: 0.5; } 100% { transform: scale(1.12); opacity: 0; } }
@keyframes stamp-in { from { opacity: 0; transform: rotate(var(--tilt)) scale(1.35); } to { opacity: 0.94; transform: rotate(var(--tilt)) scale(1); } }
@keyframes beacon { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }
@keyframes beam-breathe { 0%, 100% { opacity: 0.85; } 50% { opacity: 0.5; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .signal .ring { opacity: 0.2; }
}
