/* ===================================================
   John Rothfusz — site styles
   Fonts: Hathama (logo/signature), 1942 (headings + buttons),
          Special Elite (nav + captions), EB Garamond (reading text),
          Poppins (fine print)
   Families are declared once as tokens in :root below; use those, not
   the literal stacks.
   =================================================== */

@font-face {
  font-family: 'Hathama';
  src: url('../assets/fonts/Hathama.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: '1942';
  src: url('../assets/fonts/1942.ttf') format('truetype');
  font-display: swap;
}

:root {
  /* Type. Special Elite is a typewriter face -- fine for a nav item or a
     caption, punishing for an 800-word post, which is why prose has its own
     token. EB Garamond runs small, so anything set in it is sized up. */
  --font-script:  'Hathama', cursive;
  --font-display: '1942', 'Courier New', monospace;
  --font-ui:      'Special Elite', 'Courier New', monospace;
  --font-read:    'EB Garamond', 'Times New Roman', Times, serif;
  --font-fine:    'Poppins', sans-serif;

  --ink: #1a1a1a;
  --paper: #ffffff;
  --gold: #CDB355;
  --gap: 3px;
  --header-h: 84px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  min-height: var(--header-h);
  border-bottom: 1px solid transparent;
}

.logo {
  font-family: var(--font-script);
  font-size: 2.1rem;
  letter-spacing: 2px;
  font-weight: 400;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.main-nav a {
  font-family: var(--font-ui);
  font-size: 1.02rem;
  letter-spacing: 0.05rem;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
}

.main-nav a:hover,
.main-nav a.active {
  border-bottom-color: var(--ink);
}

/* Honeypot field — hidden from real visitors, still reachable by bots that
   fill in every field regardless of visibility. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Buttons ---------- */

/* No box and no fill -- just the label with a hairline baseline rule. On hover
   a gold rule draws left to right over the resting one, which keeps the
   emphasis on the photographs rather than on chrome. */

.btn {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1;
  letter-spacing: 0.2em;
  text-indent: 0.2em; /* offset the trailing letter-space so the rule looks centred */
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: none;
  padding: 12px 2px 16px;
  margin: 0 14px;
  cursor: pointer;
  transition: color 0.3s ease;
}

/* Resting rule -- faint, so the control still reads as a control. */
.btn::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--ink);
  opacity: 0.3;
}

/* Gold rule, drawn in on hover. */
.btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.btn:hover,
.btn:focus-visible {
  color: #000;
}

.btn:hover::after,
.btn:focus-visible::after {
  transform: scaleX(1);
}

.btn:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn::after {
    transition: none;
  }
}

/* ---------- Home ---------- */

.home-hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  padding: 60px 40px 100px;
}

.home-hero__grid {
  display: grid;
  grid-template-columns: minmax(260px, 440px) 1fr;
  align-items: center;
  gap: 7vw;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.home-hero__media {
  margin: 0;
}

.home-hero__media img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.home-hero__inner {
  max-width: 520px;
  text-align: left;
}

.home-hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: 0.35rem;
  margin: 0 0 24px;
}

.home-hero p {
  font-family: var(--font-read);
  line-height: 1.7;
  font-size: 1.19rem;
  margin: 0 0 36px;
}

@media (max-width: 860px) {
  .home-hero {
    min-height: auto;
    padding: 48px 24px 80px;
  }
  .home-hero__grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .home-hero__media img {
    max-width: 340px;
    margin: 0 auto;
  }
  .home-hero__inner {
    max-width: 100%;
    text-align: center;
    margin: 0 auto;
  }
}

/* ---------- Page title ---------- */

.page-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: 0.1rem;
  margin: 48px 0 40px;
}

.page-subtitle {
  text-align: center;
  font-family: var(--font-ui);
  font-style: italic;
  font-size: 1rem;
  margin: -24px 0 40px;
  color: #444;
}

/* ---------- Gallery ---------- */

/* Composed rows, made up the way a page is set on a press: each row is an
   explicit group whose contents were chosen, not left to the browser to wrap.
   Within a row every figure grows in proportion to its aspect ratio from a
   zero basis, so the row resolves to a single shared height and sits flush to
   both margins -- the last row included, which is what gives the block its
   straight bottom edge. Nothing is cropped: each figure's ratio is its own
   photo's, carried in --ar from the real file dimensions. */

.gallery {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: var(--gap) 0;
}

.gallery__row {
  display: flex;
  gap: var(--gap);
}

.gallery figure {
  margin: 0;
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
  background: #eee;
  aspect-ratio: var(--ar, 1.5);
  flex: var(--ar, 1.5) 1 0;
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* the figure carries the photo's own ratio, so no crop */
  transition: transform 0.5s ease;
}

.gallery figure:hover img {
  transform: scale(1.04);
}

/* On a phone a three-up row is too short to read, so rows stack and each
   photo runs the full width at its own natural height.
   The flex reset matters: once the row is a column, flex-basis and flex-grow
   act on HEIGHT, so leaving `flex: var(--ar) 1 0` in place would give every
   figure a zero basis on an auto-height row and collapse it. `flex: none`
   hands sizing back to width + aspect-ratio. */
@media (max-width: 700px) {
  .gallery__row {
    flex-direction: column;
  }
  .gallery figure {
    flex: none;
    width: 100%;
  }
}

.gallery-cta {
  text-align: center;
  padding: 56px 24px 90px;
}

.gallery-cta p {
  font-family: var(--font-fine);
  font-size: 0.85rem;
  color: #5c5c5c;
  margin-bottom: 18px;
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px;
}

.lightbox.is-open { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 12px 18px;
}

.lightbox__close { top: 12px; right: 20px; }
.lightbox__prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ---------- Contact ---------- */

.contact-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 64px 24px 110px;
  text-align: center;
}

.contact-wrap .page-title { margin-top: 0; margin-bottom: 20px; }

.contact-intro {
  font-family: var(--font-read);
  line-height: 1.7;
  font-size: 1.19rem;
  max-width: 460px;
  margin: 0 auto 14px;
}

.contact-note {
  font-family: var(--font-fine);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: #6b6b6b;
  margin: 0 0 52px;
}

form.contact-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px 24px;
  text-align: left;
}

form.contact-form .full { grid-column: 1 / -1; }

form.contact-form label {
  display: block;
  font-family: var(--font-fine);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: #555;
}

form.contact-form label .req {
  color: #999;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

form.contact-form input,
form.contact-form textarea,
form.contact-form select {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid #d8d8d5;
  border-radius: 0;
  background: transparent;
  padding: 6px 2px 10px;
  font-family: var(--font-fine);
  font-size: 1rem;
  color: var(--ink);
  transition: border-color 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

form.contact-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231a1a1a' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 20px;
  cursor: pointer;
}

form.contact-form select:invalid { color: #8a8a8a; }

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

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

form.contact-form .submit-row {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 20px;
}

.form-status {
  grid-column: 1 / -1;
  text-align: center;
  font-family: var(--font-fine);
  font-size: 0.85rem;
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 30px 24px 40px;
  font-family: var(--font-fine);
  font-size: 0.75rem;
  color: #6b6b6b;
}

.site-footer p { margin: 0; }

.site-footer__social {
  margin-bottom: 10px !important;
  display: flex;
  gap: 18px;
  justify-content: center;
}

.site-footer__social a {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.site-footer__social a:hover { border-bottom-color: #6b6b6b; }

/* ---------- Layout ---------- */

/* Galleries run full-bleed; everything else sits in a measured column. */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 90px;
}

.section-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 34px;
}

/* On the Etc. hub this heading follows the topic cards directly, and with no
   top margin it collided with the "2 posts" line above it. */
.cards + .section-title {
  margin-top: 84px;
}

/* A hairline above the label, so sections separate without a heavy rule. */
.home-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 0;
}

.home-section:last-of-type { padding-bottom: 90px; }

.home-section__more {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  margin: 34px 0 0;
}

.home-section__more a { border-bottom: 1px solid var(--ink); padding-bottom: 2px; }

.crumb {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: #5c5c5c;
  margin: 40px 0 0;
}

.crumb a { border-bottom: 1px solid #d8d8d5; padding-bottom: 2px; }
.crumb a:hover { border-bottom-color: var(--gold); }

.empty-note {
  text-align: center;
  font-family: var(--font-ui);
  color: #6b6b6b;
  padding: 40px 0 80px;
}

/* ---------- Cards ---------- */

/* Used for the gallery trio on the home page and the topic list under Etc.
   No boxes or shadows -- the picture and the label carry it, the same way the
   galleries do. */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 40px 30px;
}

.card__link { display: block; }

.card__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eee;
  transition: opacity 0.35s ease;
}

.card__link:hover .card__img { opacity: 0.86; }

.card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 16px 0 0;
  display: inline-block;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
}

.card__link:hover .card__title { border-bottom-color: var(--ink); }

.card__blurb {
  font-family: var(--font-read);
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 10px 0 0;
}

.card__meta {
  font-family: var(--font-fine);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a8a8a;
  margin: 8px 0 0;
}

/* ---------- Post lists ---------- */

.post-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 720px;
}

.post-list__item {
  border-top: 1px solid #d8d8d5;
  padding: 28px 0;
}

.post-list__item:last-child { border-bottom: 1px solid #d8d8d5; }

.post-list__item h2,
.post-list__item h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  margin: 0;
  display: inline-block;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
}

.post-list__item a:hover h2,
.post-list__item a:hover h3 { border-bottom-color: var(--ink); }

.post-list__date {
  font-family: var(--font-fine);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a8a8a;
  margin: 10px 0 0;
}

.post-list__blurb {
  font-family: var(--font-read);
  font-size: 1.08rem;
  line-height: 1.6;
  margin: 10px 0 0;
  color: #333;
}

/* ---------- Post ---------- */

.post__title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: 0.08em;
  line-height: 1.3;
  margin: 20px 0 14px;
}

.post__date {
  text-align: center;
  font-family: var(--font-fine);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8a8a;
  margin: 0 0 52px;
}

.post__back {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  margin: 64px 0 0;
}

.post__back a { border-bottom: 1px solid var(--ink); padding-bottom: 2px; }

/* ---------- Prose ---------- */

/* The reading column. Everything here is EB Garamond at a size that suits it:
   Garamond's x-height is small, so 1.19rem here reads about the same as 1rem
   in the typewriter face it replaced. 68ch keeps lines short enough to track
   from one to the next. */
.prose {
  max-width: 68ch;
  margin: 0 auto;
  font-family: var(--font-read);
  font-size: 1.19rem;
  line-height: 1.7;
}

.prose > *:first-child { margin-top: 0; }

.prose p { margin: 0 0 1.3em; }

.prose h2,
.prose h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.35;
}

.prose h2 { font-size: 1.35rem; margin: 2.2em 0 0.7em; }
.prose h3 { font-size: 1.12rem; margin: 1.9em 0 0.6em; }

.prose a {
  border-bottom: 1px solid #b8b8b2;
  padding-bottom: 1px;
  transition: border-color 0.2s ease;
}

.prose a:hover { border-bottom-color: var(--gold); }

.prose ul,
.prose ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.prose li { margin-bottom: 0.5em; }

.prose blockquote {
  margin: 1.8em 0;
  padding: 0.2em 0 0.2em 1.4em;
  border-left: 2px solid var(--gold);
  font-style: italic;
  color: #444;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr {
  border: none;
  border-top: 1px solid #d8d8d5;
  margin: 2.6em 0;
}

.prose figure { margin: 2.2em 0; }

.prose figcaption {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: #5c5c5c;
  margin-top: 10px;
  text-align: center;
}

.prose code {
  font-family: 'Courier New', monospace;
  font-size: 0.92em;
  background: #f4f4f1;
  padding: 0.1em 0.35em;
}

.prose pre {
  background: #f4f4f1;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.55;
}

.prose pre code { background: none; padding: 0; }

@media (max-width: 700px) {
  .prose { font-size: 1.14rem; }
  .post__title { font-size: 1.6rem; }
  .home-section { padding-top: 48px; }
}


/* Phone screenshots sit three across rather than as three tall images in a
   row down the column. Falls back to a single column on a narrow screen. */
.prose .shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 2.2em 0;
}

.prose .shots figure { margin: 0; }

.prose .shots img { border: 1px solid #d8d8d5; }

.prose .shots figcaption { font-size: 0.78rem; margin-top: 8px; }

@media (max-width: 640px) {
  .prose .shots { grid-template-columns: 1fr; max-width: 320px; margin-inline: auto; }
}

/* ---------- Mobile nav ---------- */

@media (max-width: 720px) {
  :root { --header-h: 120px; }
  .site-header {
    padding: 14px 20px;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 10px;
    position: static; /* avoid a wrapped sticky header eating the viewport */
  }
  .logo { font-size: 1.5rem; }
  .main-nav { gap: 12px 18px; justify-content: center; }
  .main-nav a { font-size: 0.88rem; }
  form.contact-form { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .main-nav { gap: 10px 14px; }
  .main-nav a { font-size: 0.82rem; }
}
