/* =========================================================
   Design
   ========================================================= */
:root {
  --color-bg: #17140f;
  --color-surface: #1e1a13;
  --color-surface-raised: #241f16;
  --color-text: #ede7db;
  --color-text-muted: #a69a85;
  --color-accent: #b98a46;
  --color-accent-dim: #8c6a38;
  --color-hairline: #34301f;
  --color-danger: #c9705a;

  /* Semplicità first, Poppins as the free/licensed fallback font */
  --font-display: "Semplicita", "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Semplicita", "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;

  --content-width: 720px;
  --gap: clamp(1.25rem, 2.5vw, 2rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   Semplicità — self-hosted font
   ========================================================= */
@font-face {
  font-family: "Semplicita";
  src: url("fonts/Semplicita-Light.woff2") format("woff2"),
       url("fonts/Semplicita-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Semplicita";
  src: url("fonts/Semplicita-Regular.woff2") format("woff2"),
       url("fonts/Semplicita-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Semplicita";
  src: url("fonts/Semplicita-Medium.woff2") format("woff2"),
       url("fonts/Semplicita-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Semplicita";
  src: url("fonts/Semplicita-Bold.woff2") format("woff2"),
       url("fonts/Semplicita-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   Reset & base
   ========================================================= */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

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

img { max-width: 100%; display: block; }

a { color: inherit; }

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* =========================================================
   Banner
   ========================================================= */
.banner {
  /* Reduced bottom padding + the logo's own negative margin (below)
     let the mark's lower flourish overlap into the About section
     rather than sitting in a fully boxed-off strip. */
  padding: clamp(1.25rem, 3.5vw, 2rem) var(--gap) 0;
  text-align: center;
  position: relative;
  z-index: 1; /* stack above the copy it overlaps */
}

.wordmark {
  display: inline-block;
  line-height: 0; /* avoids extra vertical gap under the masked shape */
}

.logo-mark {
  display: block;
  /* Static mark now (no interaction), so it's sized for presence rather
     than squeezed into a fixed-height strip. aspect-ratio keeps it true
     to the source SVG's 463:322 proportions instead of letterboxing. */
  width: clamp(170px, 34vw, 260px);
  aspect-ratio: 463 / 322;
  height: auto;
  background-color: var(--color-text);
  -webkit-mask: url("logo.svg") no-repeat center / contain;
          mask: url("logo.svg") no-repeat center / contain;
  margin: 0 auto clamp(-1.5rem, -4.5vw, -0.75rem);
}

/* =========================================================
   About
   ========================================================= */
.about {
  padding: 1rem var(--gap) clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--color-hairline);
}

.about-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.about h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  line-height: 1.2;
}

.about p {
  margin: 0 auto;
  max-width: 56ch;
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* =========================================================
   Photo feed — one image per line, native aspect ratio,
   randomized order comes from script.js
   ========================================================= */
.feed {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) var(--gap) 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2.5rem, 6vw, 4rem);
}

.feed-loading {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.photo-item {
  width: 100%;
  margin: 0;
}

.photo-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px 2px 0 0;
  background: var(--color-surface);
}

/* Static caption bar sitting under each image, always visible */
.photo-caption {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 3rem;
  background: var(--color-surface);
  border-left: 2px solid var(--color-accent);
  border-radius: 0 0 2px 2px;
  padding: 0.75rem 0.9rem;
}

.photo-caption-text {
  margin: 0;
  color: var(--color-text);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  line-height: 1.5;
  /* Clamp to two lines by default; longer captions get a "More" toggle
     (added by script.js only when the text actually overflows) so a
     full paragraph can still drop down when needed. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.photo-caption.is-expanded .photo-caption-text {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

.photo-caption-toggle {
  display: block;
  margin: 0.35rem 0 0;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.photo-caption-toggle[hidden] {
  display: none;
}

.photo-caption-toggle:hover,
.photo-caption-toggle:focus-visible {
  color: #cf9c56;
}

.feed-sentinel {
  width: 100%;
  height: 1px;
}

/* =========================================================
   Load more (breaks up the infinite scroll every couple of
   auto-loaded batches — see script.js FEED_CONFIG)
   ========================================================= */
.load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.75rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-hairline);
  border-radius: 999px;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.load-more-btn[hidden] {
  display: none;
}

.load-more-btn:hover,
.load-more-btn:focus-visible {
  background: var(--color-hairline);
  border-color: var(--color-accent);
}

/* =========================================================
   Floating contact button (always visible,
   fixed over the page content)
   ========================================================= */
.contact-toggle {
  position: fixed;
  right: clamp(1rem, 3vw, 1.75rem);
  bottom: calc(clamp(1rem, 3vw, 1.75rem) + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-accent);
  color: #17140f;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.contact-toggle:hover,
.contact-toggle:focus-visible {
  background: #cf9c56;
  transform: translateY(-2px);
}

.contact-toggle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #17140f;
}

/* =========================================================
   Contact drawer — slides in from the right over the page
   Opened/closed via the .is-open class in script.js.
   ========================================================= */
.contact-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 6, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
  z-index: 45;
}

.contact-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.contact {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(440px, 100vw);
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: var(--color-surface);
  border-left: 1px solid var(--color-hairline);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.4);
  padding: clamp(2.5rem, 6vw, 3.5rem) var(--gap) 3rem;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease);
}

.contact.is-open {
  transform: translateX(0);
}

.contact-inner {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.contact-mark {
  display: block;
  width: 40px;
  aspect-ratio: 187.0056 / 143.60793; /* bird.svg's native proportions */
  height: auto;
  margin: 0 0 1.1rem;
  background-color: var(--color-accent);
  -webkit-mask: url("bird.svg") no-repeat center / contain;
          mask: url("bird.svg") no-repeat center / contain;
}

.contact-close {
  position: absolute;
  top: -0.5rem;
  right: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--color-hairline);
  background: var(--color-surface-raised);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

/* Drawn as two crossed bars rather than an "×" glyph — font metrics
   for that character rarely sit dead-centre in its own box, which is
   what made the old text-based X look off-centre in the circle. */
.contact-close::before,
.contact-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.85rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.contact-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.contact-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.contact-close:hover,
.contact-close:focus-visible {
  background: var(--color-hairline);
  color: var(--color-text);
}

body.drawer-open {
  overflow: hidden;
}

.contact h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 1.8rem);
}

.contact-lede {
  margin: 0 0 2rem;
  color: var(--color-text-muted);
}

.field {
  margin: 0 0 1.1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-hairline);
  border-radius: 3px;
  padding: 0.7rem 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--color-accent);
}

/* Honeypot — hidden from sighted & mouse users, but present
   in the DOM for bots that fill every field indiscriminately */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.field-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.submit-btn {
  background: var(--color-accent);
  color: #17140f;
  border: none;
  border-radius: 3px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.submit-btn:hover,
.submit-btn:focus-visible {
  background: #cf9c56;
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-status {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.form-status.is-error { color: var(--color-danger); }
.form-status.is-success { color: var(--color-accent); }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  padding: 2rem var(--gap) 3rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  background: var(--color-surface);
}

/* =========================================================
   Small-screen refinement
   ========================================================= */
@media (max-width: 480px) {
  .contact-toggle span:not(.contact-toggle-dot) {
    font-size: 0.85rem;
  }
}
