/* Diari del Vi — white, minimal, mobile-first */
:root {
  --paper: #ffffff;
  --paper-soft: #f7f7f6;
  --ink: #1a1a1a;
  --ink-soft: #5c5c5c;
  --line: #e8e8e6;
  --line-strong: #d4d4d1;
  --accent: #6e1f2c;
  --focus: #6e1f2c;
  --tap: 2.75rem;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 6.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.7;
  font-optical-sizing: auto;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 20;
}
.skip:focus { left: 0.75rem; top: 0.75rem; }

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--paper);
  max-width: 44rem;
  margin: 0 auto;
}
.site-brand { min-width: 0; }
.site-kicker {
  display: block;
  font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}
.site-title {
  font-family: "Cormorant Garamond", Palatino, "Palatino Linotype", serif;
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 2.75rem);
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}
.site-title a { color: inherit; text-decoration: none; }
.site-title a:hover { color: var(--accent); }
.site-tagline {
  margin: 0.3rem 0 0;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.header-archive {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 0.95rem;
  margin-top: 0.15rem;
  font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  white-space: nowrap;
}
.header-archive:hover,
.header-archive:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

/* Persistent section menu — exact order, large tap targets */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem 0.75rem;
  max-width: 44rem;
  margin: 0 auto;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
nav.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 0.85rem;
  color: var(--ink);
  text-decoration: none;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
}
nav.site-nav a:hover,
nav.site-nav a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}
nav.site-nav a[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.edition-kicker,
.lead-kicker {
  font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 2rem 0 0.35rem;
}
.lead-kicker { margin-top: 0; }
.edition-date {
  font-family: "Cormorant Garamond", Palatino, serif;
  font-size: clamp(1.7rem, 5vw, 2.15rem);
  font-weight: 500;
  margin: 0 0 0.45rem;
  color: var(--ink);
  line-height: 1.2;
}
.edition-date time { font-style: normal; }
.edition-permalink,
.section-count {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.9rem;
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
}
.edition-permalink a,
.more a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  font-family: "Source Sans 3", sans-serif;
}
.edition-permalink a:hover,
.more a:hover { opacity: 0.8; }
.more { margin: 0.85rem 0 0.2rem; }

/* Lead story on the front page */
article.lead {
  padding: 0 0 1.5rem;
  margin: 0 0 0.5rem;
  border-bottom: 1px solid var(--line);
}
article.lead h2 {
  font-family: "Cormorant Garamond", Palatino, serif;
  font-size: clamp(1.7rem, 5vw, 2.2rem);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--ink);
}
article.lead p { margin: 0 0 0.45rem; }

/* Collapsible sections */
details.fold {
  border-top: 1px solid var(--line);
  background: var(--paper);
}
details.fold:last-of-type { border-bottom: 1px solid var(--line); }

details.fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: 3.15rem;
  padding: 0.7rem 0;
  font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  user-select: none;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.75rem;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
details.fold[open] > summary::before {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}
.fold-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}
.fold-title {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  line-height: 1.3;
}
.fold-count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
details.fold[open] > summary .fold-title { color: var(--accent); }
details.fold > summary:hover .fold-title,
details.fold > summary:hover::before { color: var(--accent); border-color: var(--accent); }
details.fold > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.fold-body { padding: 0.15rem 0 1.15rem 1.2rem; }

.fold-body details.fold { border-top: 1px solid var(--line); border-bottom: none; }
.fold-body details.fold:last-of-type { border-bottom: none; }
.fold-body details.fold > summary { min-height: 2.75rem; padding: 0.45rem 0; }
.fold-body details.fold .fold-title { font-size: 0.98rem; }
.fold-body details.fold .fold-body { padding-left: 1.1rem; }

article.item { margin: 0 0 1.5rem; }
article.item:last-child { margin-bottom: 0.35rem; }
.item-topic {
  font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.2rem;
}
.item-topic a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.item-topic a:hover { color: var(--accent); border-color: var(--accent); }
article.item h3,
article.wine-card h3 {
  font-family: "Cormorant Garamond", Palatino, serif;
  font-size: 1.38rem;
  font-weight: 600;
  line-height: 1.28;
  margin: 0 0 0.35rem;
  color: var(--ink);
}
article.item p { margin: 0 0 0.4rem; }

a.source {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.92rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
a.source:hover,
a.source:focus { opacity: 0.8; }

/* Recommended wine cards — only show fields present in the source */
article.wine-card {
  padding: 0.9rem 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
article.wine-card:last-of-type { border-bottom: none; }
.wine-meta {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0 0 0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.15rem;
}
.wine-dot { margin: 0 0.4rem; color: var(--line-strong); }
.wine-notes { margin: 0 0 0.4rem; }

.caption,
.events-edition-title {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.02rem;
  margin: 0 0 0.85rem;
}
.events-edition-title { font-style: normal; font-weight: 600; color: var(--ink); }

.group-title {
  font-family: "Cormorant Garamond", Palatino, serif;
  font-size: 1.25rem;
  font-weight: 500;
  margin: 1rem 0 0.6rem;
}

.events { list-style: none; padding: 0; margin: 0; }
.events > li {
  margin: 0 0 1.05rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--line);
}
.events .lead { font-weight: 600; color: var(--ink); }
.events .sub { margin: 0.4rem 0 0 0.2rem; padding: 0 0 0 1.1rem; }
.events .sub li { margin: 0.25rem 0; }
.event-links { display: inline; }
.event-links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.95em;
}
.event-links a:hover { opacity: 0.8; }
.event-links .sep { color: var(--ink-soft); margin: 0 0.15rem; }

.note, .empty {
  margin: 1.15rem 0 0;
  font-style: italic;
  color: var(--ink-soft);
}
.empty { margin: 0.4rem 0 0.2rem; }

.archive {
  margin-top: 2.75rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.archive h2 {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
}
.archive ul { list-style: none; padding: 0; margin: 0; }
.archive li { border-bottom: 1px solid var(--line); }
.archive a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  min-height: var(--tap);
  padding: 0.7rem 0;
  color: var(--ink);
  text-decoration: none;
  font-family: "Cormorant Garamond", Palatino, serif;
  font-size: 1.25rem;
}
.archive a:hover { color: var(--accent); }
.archive a .when {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.88rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.archive a.current { font-weight: 600; }

.site-footer {
  text-align: center;
  padding: 1.4rem 1.25rem 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.85rem;
}
.site-footer p { margin: 0.25rem 0; }
.site-footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}
.site-footer a:hover { color: var(--accent); border-color: var(--accent); }

.not-found { text-align: center; padding: 4rem 1.25rem; }
.not-found h1 {
  font-family: "Cormorant Garamond", Palatino, serif;
  font-weight: 500;
  font-size: 2.2rem;
  color: var(--ink);
  margin: 0 0 0.6rem;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  body { font-size: 1.06rem; }
  article.item h3, article.wine-card h3 { font-size: 1.26rem; }
  article.lead h2 { font-size: 1.55rem; }
  .archive a { flex-direction: column; gap: 0.1rem; padding: 0.85rem 0; }
  .fold-body { padding-left: 0.15rem; }
  .fold-body details.fold .fold-body { padding-left: 0.15rem; }
  nav.site-nav { padding-left: 1rem; padding-right: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  details.fold > summary::before { transition: none; }
}

@media print {
  body { background: #fff; font-size: 11pt; }
  .site-header, .archive, .site-footer, nav.site-nav { break-inside: avoid; }
  nav.site-nav, .header-archive, .skip { display: none !important; }
  details.fold { border: none; break-inside: avoid; }
  details.fold > summary { min-height: 0; padding: 0.4rem 0; }
  details.fold > summary::before { display: none; }
  .fold-body, details:not([open]) .fold-body { display: block !important; }
  a.source, .event-links a { color: inherit; border-bottom: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
}
