/* ==========================================================================
   Global Styles, The Neighbourhood Penryn
   ========================================================================== */

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  font-size: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

/* ---- Selection ---- */
::selection {
  background-color: var(--color-brand);
  color: var(--color-warm-white);
}

/* ---- Focus ---- */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p {
  margin-bottom: var(--space-md);
  max-width: 65ch;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-brand-dark);
}

strong, b {
  font-weight: var(--weight-semibold);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
}

blockquote {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-style: italic;
  line-height: var(--leading-snug);
  color: var(--text-secondary);
  border-left: 2px solid var(--color-brand);
  padding-left: var(--space-lg);
  margin: var(--space-xl) 0;
}

/* ---- Images ---- */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

/* ---- Lists ---- */
ul, ol {
  padding-left: 1.25em;
}

li {
  margin-bottom: var(--space-2xs);
}

/* ---- Horizontal Rule ---- */
hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--space-xl) 0;
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide {
  max-width: var(--container-wide);
}

.container--content {
  max-width: var(--container-content);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--space-section);
}

.section--compact {
  padding-block: var(--space-2xl);
}

.section--flush {
  padding-block: 0;
}

/* ---- Grid ---- */
.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Components
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  padding: 1em 2.25em;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
  line-height: 1;
}

.btn--primary {
  background-color: var(--color-brand);
  color: var(--color-warm-white);
}

.btn--primary:hover {
  background-color: var(--color-brand-dark);
  color: var(--color-warm-white);
}

.btn--secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
}

.btn--secondary:hover {
  background-color: var(--color-ink);
  color: var(--color-warm-white);
}

.btn--ghost {
  background-color: transparent;
  color: var(--color-warm-white);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn--ghost:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.8);
  color: var(--color-warm-white);
}

.btn--dark {
  background-color: var(--color-ink);
  color: var(--color-warm-white);
}

.btn--dark:hover {
  background-color: var(--color-charcoal);
  color: var(--color-warm-white);
}

.btn--sm {
  font-size: var(--text-xs);
  padding: 0.75em 1.5em;
}

.btn--lg {
  padding: 1.25em 3em;
}

/* ---- Text Link ---- */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
}

.text-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: currentColor;
  transition: width var(--duration-base) var(--ease-smooth);
}

.text-link:hover::after {
  width: 100%;
}

.text-link:hover {
  color: var(--color-brand);
}

.text-link svg {
  width: 1em;
  height: 1em;
  transition: transform var(--duration-fast) var(--ease-out);
}

.text-link:hover svg {
  transform: translateX(3px);
}

/* ---- Section Headings ---- */
.section-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.section-heading {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-lg);
}

.section-intro {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: 55ch;
}

/* ---- Divider ---- */
.divider {
  width: 40px;
  height: 1px;
  background-color: var(--color-brand);
  margin: var(--space-lg) 0;
}

.divider--center {
  margin-inline: auto;
}

/* ---- Card ---- */
.card {
  background-color: var(--bg-primary);
  overflow: hidden;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card__image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.card:hover .card__image img {
  transform: scale(1.03);
}

.card__body {
  padding: var(--space-lg);
}

.card__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
}

.card__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  padding: 0.875em 1em;
  background-color: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-brand);
  outline: none;
}

.form-textarea {
  min-height: 160px;
  resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mx-auto { margin-inline: auto; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.no-scroll {
  overflow: hidden;
}

/* ==========================================================================
   Motion, v2.2 signature: "reveal by light"
   Two distinct motions (never one uniform fade-up): text/blocks SETTLE with
   the pour easing; media UNVEILS via a directional clip-path wipe. Triggered
   by .is-visible (IntersectionObserver in main.js); reduced-motion honoured.
   ========================================================================== */

/* Text & blocks, a slow, settled rise (pour easing), not a snappy fade-up */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--duration-slower) var(--ease-pour),
              transform var(--duration-slower) var(--ease-pour);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal--delay-1 { transition-delay: 120ms; }
.reveal--delay-2 { transition-delay: 240ms; }
.reveal--delay-3 { transition-delay: 360ms; }
.reveal--delay-4 { transition-delay: 480ms; }
.reveal--delay-5 { transition-delay: 600ms; }

/* Media, the signature: a left-to-right clip wipe ("reveal by light").
   Driven by a CSS scroll timeline where supported (no JS, no IntersectionObserver
   geometry quirks with clipped elements); falls back to FULLY VISIBLE where
   unsupported (e.g. older Safari) so media is never hidden behind a trigger. */
.unveil {
  clip-path: inset(0 0 0 0);
}
.unveil > img,
.unveil > video,
.unveil > .media-fill {
  transform: none;
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .unveil {
      animation: unveilWipe linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 35%;
    }
    .unveil > img,
    .unveil > video,
    .unveil > .media-fill {
      animation: unveilScale linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 35%;
    }
  }
}

@keyframes unveilWipe {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes unveilScale {
  from { transform: scale(1.08); }
  to   { transform: scale(1); }
}

/* Quality Floor, motion is a privilege, not a requirement */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .unveil {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
  }
  .unveil > img,
  .unveil > video {
    transform: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Dark Section Variant
   ========================================================================== */

.section--dark {
  background-color: var(--bg-dark);
  color: var(--text-inverse);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
  color: var(--text-inverse);
}

.section--dark p {
  color: rgba(255, 255, 255, 0.75);
}

.section--dark .section-label {
  color: var(--color-stone);
}

.section--dark .section-intro {
  color: rgba(255, 255, 255, 0.65);
}

.section--dark .divider {
  background-color: var(--color-brass);
}

.section--dark .text-link {
  color: var(--color-warm-white);
}

.section--dark .form-input,
.section--dark .form-textarea {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--color-warm-white);
}

.section--dark .form-input:focus,
.section--dark .form-textarea:focus {
  border-color: var(--color-brass);
}

.section--dark .form-label {
  color: var(--color-stone);
}

/* ---- Cream Section ---- */
.section--cream {
  background-color: var(--bg-secondary);
}

/* ---- Chalk Section ---- */
.section--chalk {
  background-color: var(--bg-accent);
}

/* ==========================================================================
   WordPress Specific
   ========================================================================== */

.alignwide {
  max-width: var(--container-wide);
  margin-inline: auto;
}

.alignfull {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.wp-caption {
  max-width: 100%;
}

.wp-caption-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ==========================================================================
   v2.0, Hybrid typography (Montserrat for UI, Playfair kept for display)
   ========================================================================== */
.btn,
.section-label,
.text-link,
.header-cta {
  font-family: var(--font-ui);
}

/* Buttons: gentler weight + tighter tracking now they're geometric sans */
.btn {
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
}

/* Section labels (eyebrows) stay small caps but in Montserrat */
.section-label {
  font-weight: var(--weight-semibold);
}
