/* Leach Knives — hand-written stylesheet, 2026 rewrite.
   Design tokens and layout faithfully ported from the original Django site
   (Bootstrap 4 + animate.css + Font Awesome, ~340KB → this file). */

@font-face {
  font-family: "Fjalla One";
  src: url(/static/fonts/fjalla-one.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #fbf8f5;
  --ink: #000;
  --font-display: "Fjalla One", sans-serif;
  --font-body: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.3s ease, color 0.3s ease;
}

a img {
  transition: opacity 0.3s ease;
}

a:hover img,
.knife-nav a:hover,
.contact a:hover {
  opacity: 0.5;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  margin-right: 0.4em;
}

.icon-lg {
  width: 3rem;
  height: 3rem;
  margin: 0;
}

/* Page fade-in (was animate.css fadeIn gated on imagesLoaded). */
main {
  opacity: 0;
  transition: opacity 0.8s ease;
}
body.loaded main {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  main {
    opacity: 1;
    transition: none;
  }
}

/* ── Header ──────────────────────────────────────────────────────────── */

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1em 2em;
  font-size: 0.8em;
  letter-spacing: 0.15em;
  text-transform: lowercase;
}

.brand {
  display: flex;
  flex-direction: column;
  width: 140px;
}

.brand img {
  display: block;
  width: 140px;
  height: auto;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75em 1.5em;
  max-width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 767px) {
  .site-header {
    flex-direction: column;
    align-items: center;
  }
  .contact {
    margin-top: 3em;
  }
}

@media (max-width: 575px) {
  .site-header {
    font-size: 0.7em;
  }
}

/* ── Home / 404 ──────────────────────────────────────────────────────── */

.logo-stack {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 66%;
  max-width: 768px;
}

.logo-stack img {
  display: block;
  width: 100%;
  height: auto;
}

.error {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  text-wrap: balance;
  font-size: 1.75rem;
}

.error a {
  text-decoration: underline;
}

/* ── Knives gallery ──────────────────────────────────────────────────── */

.gallery {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 15px;
}

.knife-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.knife-grid li {
  padding-bottom: 2em;
}

.knife-grid img {
  width: 100%;
}

.thumb-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  text-transform: uppercase;
  margin: 12px 0 4px;
}

.thumb-caption {
  font-size: 0.9em;
  margin: 0;
  text-wrap: pretty;
}

.thumb-count {
  font-family: var(--font-display);
  font-size: 0.9em;
  margin: 8px 0 0;
}

/* ── Knife detail ────────────────────────────────────────────────────── */

@media (min-width: 992px) {
  .knife article {
    position: absolute;
    top: 164px;
    bottom: 48px;
    left: 0;
    right: 0;
    min-height: 360px;
    display: flex;
    align-items: flex-end;
  }
  .knife .knife-info {
    order: 1;
    width: 25%;
    max-width: 400px;
    margin-left: 14vw;
    text-align: right;
  }
  .knife .knife-photo {
    order: 2;
    max-width: 612px;
    max-height: 100%;
    width: auto;
    height: auto;
    margin-left: 48px;
  }
  .knife .knife-nav a {
    position: fixed;
    top: 60px;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
  }
  .knife .knife-nav .prev {
    left: 0;
  }
  .knife .knife-nav .next {
    right: 0;
  }
}

@media (min-width: 992px) and (max-width: 1199px) {
  .knife .knife-photo {
    max-width: 500px;
  }
}

@media (max-width: 991px) {
  .knife {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px 2em;
  }
  .knife .knife-photo {
    width: 100%;
  }
  .knife .knife-nav {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-top: 8px;
  }
}

/* ── About ───────────────────────────────────────────────────────────── */

.about {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 15px;
}

.video-box {
  margin: 1rem 0 3rem;
}

.video-box video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.about-grid {
  display: grid;
  gap: 30px;
  font-size: 0.9em;
  margin-bottom: 3em;
}

.portrait {
  margin-bottom: 2em;
}

.about-text h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

.about-text p {
  padding: 0 0 12px;
  margin: 0;
}

@media (min-width: 992px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
  }
  .about-text {
    order: -1;
    text-align: right;
  }
  .about-text h2 {
    padding-right: 12px;
  }
  .about-text p {
    padding: 0 12px 12px;
  }
}

/* ── Home single-page scroll (mobile only) ───────────────────────────── */
/* On phones the home page becomes one continuous scroll:
   logo → video → knives → about → portrait → contact.
   Desktop (≥768px) keeps the fixed centered logo splash and never renders
   or downloads these sections (display:none + lazy media + JS-gated video). */

.home-scroll {
  display: none;
}

@media (max-width: 767px) {
  .home .logo-stack {
    position: static;
    transform: none;
    width: 100%;
    max-width: 300px;
    margin: 1.5rem auto 0;
    padding: 0 24px;
  }
  .home-scroll {
    display: block;
    max-width: 1140px;
    margin: 3rem auto 0;
    padding: 0 15px;
    font-size: 0.9em;
  }
  .home-scroll > * + * {
    margin-top: 3rem;
  }
  .home-scroll .video-box {
    margin: 0;
  }
  .home-scroll .portrait {
    display: block;
    width: 100%;
    margin: 0;
  }
  .home-contact {
    text-align: center;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    padding-bottom: 3rem;
  }
}
