/* Layout, spacing and surfaces. Type families and scale live in typography.css. */
:root {
  --wine: #183c32;
  --paper: #f6f5ef;
  --surface: #edf0e9;
  --field: #fcfcf8;
  --ink: #202f29;
  --muted: #56675d;
  --line: #d7ddd4;
  --gold: #d4d8b3;
  --content-max: 75rem;
  --page-gutter: clamp(1.5rem, 6vw, 5rem);
  --page-inset: max(var(--page-gutter), calc((100vw - var(--content-max)) / 2));
  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --section-space: clamp(5rem, 9vw, 8rem);
  --column-gap: clamp(3rem, 8vw, 8rem);
  --flow-space: clamp(1.75rem, 2.5vw, 2.5rem);
  --group-space: clamp(2.5rem, 4vw, 4rem);
  --gallery-gap: clamp(1.25rem, 3vw, 2.5rem);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6.875rem; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; text-underline-offset: .3em; }
button, input, textarea { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
button, a, input, textarea, summary { touch-action: manipulation; }
:focus-visible { outline: 3px solid #b66b31; outline-offset: 5px; }
img { max-width: 100%; display: block; }
h1, h2, p, figure { margin: 0; }

/* One outer alignment for navigation, editorial sections and footer. */
.header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-4) var(--page-inset);
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; text-decoration: none; white-space: nowrap; }
.brand small { display: block; margin-top: var(--space-1); text-align: start; }
.nav { display: flex; gap: var(--group-space); }
.nav a {
  position: relative; text-decoration: none; padding: .75rem 0;
  transition: color 160ms ease-out;
}
.nav a::after {
  content: ''; position: absolute; inset-inline: 0; bottom: .35rem;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left center;
  transition: transform 180ms ease-out;
}
[dir=rtl] .nav a::after { transform-origin: right center; }
.nav a[aria-current=location], .nav a:focus-visible { color: var(--wine); }
.nav a[aria-current=location]::after, .nav a:focus-visible::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) {
  .nav a:hover { color: var(--wine); }
  .nav a:hover::after { transform: scaleX(1); }
}
.languages { display: flex; align-items: center; gap: .125rem; }
.languages a {
  position: relative;
  padding: .625rem; min-width: 2.625rem; text-align: center;
  text-decoration: none; border-bottom: 2px solid transparent;
}
.languages a::after {
  content: ''; position: absolute; inset-inline: 0; bottom: -2px;
  height: 2px; background: var(--wine); pointer-events: none;
  opacity: 0; transform: scaleX(.6);
  transition: opacity 160ms ease-out, transform 180ms ease-out;
}
.languages a[aria-current=true]::after { opacity: 1; transform: scaleX(1); }
.section {
  padding: var(--section-space) var(--page-inset);
  scroll-margin-top: var(--space-2);
}
.eyebrow { margin-bottom: var(--space-4); color: var(--muted); }

/* Preserve the existing logo opening while aligning it to the page grid. */
.hero-logo {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: calc(100svh - var(--header-height, 100px));
  padding: 3.75rem var(--page-inset) 6.875rem;
  background: var(--paper); scroll-margin-top: var(--header-height, 100px);
}
.hero-logo img { width: min(100%, 90rem); max-height: 55svh; height: auto; object-fit: contain; }
.opening-link {
  position: absolute; bottom: var(--space-4); min-height: 3rem;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-1); text-decoration: none;
}
.opening-link span:last-child { font-size: 1.5rem; }
.hero-logo::before, .hero-logo::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image: url('assets/branding/wine-stains.png'); background-repeat: no-repeat;
  background-size: auto 100%; opacity: .44; pointer-events: none;
}
.hero-logo::before { background-position: left bottom; clip-path: inset(45% 50% 0 0); }
.hero-logo::after { background-position: right top; clip-path: inset(0 0 55% 50%); }

/* The hero is the page's principal dark surface. */
.hero {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 41.25rem; padding-inline: var(--page-inset); background: var(--wine);
}
.hero-copy {
  display: flex; flex-direction: column; align-items: flex-start;
  padding-block: clamp(4rem, 6vw, 6rem) var(--group-space);
  padding-inline: 0 clamp(2.5rem, 5vw, 5rem);
  background: var(--wine); color: var(--paper);
}
@keyframes introduction-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-copy.introduction-entered { animation: introduction-enter 480ms ease-out both; }
}
.hero .eyebrow { color: var(--gold); }
.hero-intro { margin: var(--space-4) 0 var(--space-3); color: #e0e8df; }
.hero-kosher {
  margin-bottom: var(--group-space); color: #e0e8df;
  font-size: var(--text-label); line-height: 1.6;
}
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.125rem; padding: .8125rem var(--space-3);
  border: 1px solid transparent; text-decoration: none; cursor: pointer;
  transition: background-color 160ms ease-out, transform 160ms ease-out, box-shadow 160ms ease-out;
}
.light { background: var(--paper); color: var(--wine); }
.light:focus-visible { background: #dfe6d7; }
@media (hover: hover) and (pointer: fine) {
  .button:hover { transform: translateY(-2px); box-shadow: 0 4px 12px #102b241a; }
  .light:hover { background: #dfe6d7; }
}
.button:active {
  transform: translateY(1px) scale(.985); box-shadow: none;
  transition-duration: 80ms;
}
.hero-contact { margin-top: var(--space-3); }
.hero-foot {
  display: flex; justify-content: space-between; gap: var(--space-2);
  border-top: 1px solid #668075; width: 100%; margin-top: var(--group-space);
  padding-top: var(--space-3); color: #d3ded3;
}
.hero-photo { position: relative; min-height: 100%; overflow: hidden; background: #263423; }
.hero-photo img { position: absolute; height: 100%; width: 100%; object-fit: cover; object-position: 50% 42%; }
.hero-photo::after { content: ''; position: absolute; inset: 60% 0 0; background: linear-gradient(transparent, #10100eaa); pointer-events: none; }
.hero-photo figcaption { position: absolute; bottom: var(--space-3); inset-inline: var(--space-4); color: #fff; z-index: 1; }

.story, .contact { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: var(--column-gap); }
.story { border-bottom: 1px solid var(--line); }
@keyframes story-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .story > .story-entered { animation: story-enter 480ms ease-out both; }
  .story > .story-copy.story-entered { animation-delay: 80ms; }
}
.story h2, .contact h2 { max-inline-size: 18ch; }
.signature { margin-top: var(--group-space); }
.signature span { display: block; margin-top: var(--space-1); color: var(--muted); }
.story-copy { padding-top: 0; }
.story-copy > p { margin-bottom: var(--flow-space); color: var(--muted); }
.story-copy .lead { color: var(--ink); }
.story-note { margin-top: var(--group-space); color: var(--muted); }
.story-note p { margin: 0; }
.section-heading {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--column-gap); margin-bottom: var(--group-space);
}
.section-heading > p { max-inline-size: 38ch; color: var(--muted); }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gallery-gap); }
.gallery-grid figure { min-width: 0; }
.gallery-grid a { position: relative; overflow: hidden; background: #ded5cd; display: block; cursor: zoom-in; }
.gallery-grid img { width: 100%; height: auto; aspect-ratio: 3/4; object-fit: cover; transition: transform 280ms ease-out; }
.gallery-grid a::after {
  content: ''; position: absolute; inset-inline-end: .75rem; bottom: .75rem;
  width: 2.25rem; height: 2.25rem; border: 1px solid #ffffff80;
  background: #183c32e6 url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none" stroke="white" stroke-width="1.4"%3E%3Cpath d="M7 3H3v4m10-4h4v4M3 13v4h4m10-4v4h-4"/%3E%3C/svg%3E') center/1.125rem no-repeat;
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}
.gallery-grid a:focus-visible img { transform: scale(1.025); }
.gallery-grid a:focus-visible::after { opacity: 1; transform: translateY(0); }
@media (hover: hover) and (pointer: fine) {
  .gallery-grid a:hover img { transform: scale(1.025); }
  .gallery-grid a:hover::after { opacity: 1; transform: translateY(0); }
}
.gallery-grid figcaption { padding-top: var(--space-2); color: var(--muted); font-size: .9375rem; line-height: 1.6; }
.gallery-grid [data-photo=bottle] img { object-fit: contain; background: #e5e0d6; }
.gallery-grid [data-photo=vineyard] img { object-position: 50% 35%; }
.gallery-grid [data-photo=sharing] img { object-position: 35% 45%; }
#more-photos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#more-photos img { aspect-ratio: 4/3; object-fit: contain; background: #e5e0d6; }
#more-photos [data-photo=tasting] img { object-position: 42% 45%; }
.more-gallery { margin-top: var(--group-space); }
.more-gallery summary { cursor: pointer; min-height: 2.75rem; width: fit-content; border-bottom: 1px solid var(--wine); padding: .5rem 0; }
.more-gallery[open] summary { margin-bottom: var(--group-space); }

/* A light closing surface, with the green reserved for the action. */
.contact { background: var(--surface); color: var(--ink); }
.contact-copy > p:not(.eyebrow) { margin-top: var(--flow-space); color: var(--muted); max-inline-size: 38ch; }
.email { display: inline-block; margin-top: var(--group-space); color: var(--wine); }
.contact-copy .location { margin-top: var(--group-space); }
.map-link { display: inline-block; margin-top: var(--space-1); }
.hero-contact, .email, .map-link {
  text-decoration-thickness: 1px; text-decoration-color: #7d907f;
  transition: text-underline-offset 180ms ease-out, text-decoration-color 180ms ease-out;
}
.hero-contact { text-decoration-color: #a5b7a9; }
:is(.hero-contact, .email, .map-link):focus-visible {
  text-underline-offset: .45em; text-decoration-color: currentColor;
}
@media (hover: hover) and (pointer: fine) {
  :is(.hero-contact, .email, .map-link):hover {
    text-underline-offset: .45em; text-decoration-color: currentColor;
  }
}
.contact form { max-inline-size: 36rem; }
form label { display: block; margin-bottom: var(--space-4); }
form label > span { display: block; margin-bottom: var(--space-1); transition: color 160ms ease-out; }
form label:focus-within > span { color: var(--wine); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
input, textarea {
  width: 100%; min-height: 3rem; border: 1px solid #7d907f;
  background: var(--field); color: var(--ink); padding: .625rem .75rem; border-radius: 0;
  transition: border-color 160ms ease-out, background-color 160ms ease-out, box-shadow 160ms ease-out;
}
input:focus, textarea:focus {
  border-color: var(--wine); background: #fff; box-shadow: 0 0 0 3px #183c3214;
}
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
textarea { resize: vertical; }
.field-error { margin-top: .5rem; color: #943d35; font-size: .9375rem; line-height: 1.6; }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: #943d35; }
input[aria-invalid=true]:focus-visible, textarea[aria-invalid=true]:focus-visible { outline-color: #943d35; }
@keyframes field-error-enter {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .field-error { animation: field-error-enter 160ms ease-out; }
}
.form-note { color: var(--muted); margin: 0 0 var(--space-4); }
.contact .button { background: var(--wine); color: var(--paper); }
.contact .button:focus-visible { background: #234d40; }
@media (hover: hover) and (pointer: fine) {
  .contact .button:hover { background: #234d40; }
}
#form-status { color: var(--muted); }
#form-status:not(:empty) {
  margin-top: var(--space-3); padding: var(--space-2);
  border-inline-start: 2px solid var(--wine); background: #ffffff80;
}
@keyframes form-status-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  #form-status:not(:empty) { animation: form-status-enter 200ms ease-out; }
}
footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-5) var(--page-inset);
  border-top: 1px solid var(--line);
}
footer a { padding: .5rem 0; }
footer a[data-i=top] { transition: color 180ms ease-out, text-underline-offset 180ms ease-out; }
.top-arrow { display: inline-block; margin-inline-start: .4em; transition: transform 180ms ease-out; }
footer a[data-i=top]:focus-visible { color: var(--wine); text-underline-offset: .45em; }
footer a[data-i=top]:focus-visible .top-arrow { transform: translateY(-3px); }
@media (hover: hover) and (pointer: fine) {
  footer a[data-i=top]:hover { color: var(--wine); text-underline-offset: .45em; }
  footer a[data-i=top]:hover .top-arrow { transform: translateY(-3px); }
}
.footer-brand { text-decoration: none; }

/* Full-photo viewer and keyboard access. */
dialog { padding: 1.25rem; border: 0; background: var(--paper); max-width: min(1000px, 94vw); max-height: 94vh; }
dialog::backdrop { background: #0c211ce8; }
@keyframes lightbox-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lightbox-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  dialog[open]::backdrop { animation: lightbox-backdrop-in 180ms ease-out both; }
  dialog[open].is-closing::backdrop { animation: lightbox-backdrop-out 140ms ease-in both; }
}
dialog > img { max-height: 65vh; width: auto; margin: auto; object-fit: contain; }
dialog.image-empty > img { visibility: hidden; width: min(24rem, 65vw); height: min(40vh, 20rem); }
#image-status { min-height: 1.6em; margin-top: .5rem; color: var(--muted); text-align: center; font-size: .9375rem; line-height: 1.6; }
.close { display: block; margin-inline-start: auto; border: 0; background: none; font-size: 1.875rem; cursor: pointer; min-width: 2.75rem; min-height: 2.75rem; }
.lightbox-navigation { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.lightbox-navigation button { flex-shrink: 0; min-width: 3rem; min-height: 3rem; border: 1px solid var(--line); background: var(--paper); color: var(--wine); font-size: 1.5rem; cursor: pointer; }
.lightbox-navigation p { text-align: center; padding: .75rem 0; margin: 0; }
html:has(dialog[open]) { overflow: hidden; }
.skip { position: fixed; top: .5rem; left: .5rem; transform: translateY(-160%); background: white; color: var(--wine); padding: .75rem; z-index: 10; }
.skip:focus { transform: translateY(0); }

@media (min-width: 1500px) { .hero { min-height: 47.5rem; } }
@media (max-width: 1000px) {
  .header { flex-wrap: wrap; gap: var(--space-3); padding-block: var(--space-3); }
  .nav { order: 3; width: 100%; justify-content: center; border-top: 1px solid var(--line); padding-top: var(--space-1); }
  .hero { min-height: 38.75rem; }
  .hero-copy { padding-inline-end: var(--group-space); }
  #more-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .story, .contact { grid-template-columns: 1fr; row-gap: var(--group-space); }
  .section-heading { display: block; }
  .section-heading > p { margin-top: var(--flow-space); }
}
@media (max-width: 650px) {
  html { scroll-padding-top: 1.25rem; }
  .header { column-gap: .5rem; }
  .nav { gap: clamp(.875rem, 4vw, 1.75rem); flex-wrap: wrap; }
  .languages a { padding-inline: .4375rem; min-width: 2.25rem; }
  .hero-logo { min-height: calc(85svh - var(--header-height, 145px)); padding: 2.5rem var(--page-inset) 6.25rem; }
  .hero-logo img { max-height: 45svh; }
  .hero-logo::before, .hero-logo::after { background-size: auto 70%; }
  .opening-link { bottom: var(--space-3); }
  .hero { display: flex; flex-direction: column; min-height: 0; padding-inline: 0; }
  .hero-copy { padding: var(--space-5) var(--page-inset) var(--group-space); }
  .hero-photo { height: auto; min-height: 0; aspect-ratio: 4/5; }
  .hero-photo figcaption { inset-inline: var(--page-inset); }
  .gallery-featured { grid-template-columns: 1fr; gap: var(--space-5); }
  .gallery-featured img { aspect-ratio: 4/5; }
  .gallery-featured [data-photo=bottle] img { aspect-ratio: 3/4; }
  .gallery-featured [data-photo=sharing] img { aspect-ratio: 4/3; }
  #more-photos { column-gap: var(--gallery-gap); row-gap: var(--space-4); }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  footer { flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
  .footer-brand { width: 100%; }
  .lightbox-navigation { gap: var(--space-1); }
}
@media (max-width: 360px) { .languages a { min-width: 2rem; padding-inline: .25rem; } }
@media (min-width: 901px) and (min-height: 650px) and (prefers-reduced-motion: no-preference) {
  html { scroll-snap-type: y proximity; scroll-padding-top: 0; }
  .hero-logo, .hero, .section { scroll-snap-align: start; }
  footer { scroll-snap-align: end; }
  .hero, .section { scroll-margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  *, .nav a::after, .languages a::after, .gallery-grid a::after { transition: none !important; }
  .button, .gallery-grid img, .gallery-grid a::after, .top-arrow { transform: none !important; }
}
