/* =====================================================================
   Foreground Landscape Studio — base styles and components
   Requires tokens.css. All classes are prefixed fg-.
   Load fonts in the page head:
   https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap
   ===================================================================== */

/* ---------- Base ---------- */
.fg,
.fg *,
.fg *::before,
.fg *::after {
  box-sizing: border-box;
}

.fg {
  margin: 0;
  background: var(--fg-paper);
  color: var(--fg-ink);
  font-family: var(--fg-font-text);
  font-size: var(--fg-size-body);
  font-weight: var(--fg-weight-text);
  line-height: var(--fg-leading-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.fg img,
.fg svg,
.fg video {
  display: block;
  max-width: 100%;
}

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

.fg p {
  margin: 0;
  max-width: var(--fg-measure);
}

.fg p + p {
  margin-top: 1em;
}

.fg :focus-visible {
  outline: var(--fg-hairline) solid currentColor;
  outline-offset: 4px;
}

/* ---------- Type ---------- */
.fg-h1,
.fg-h2 {
  margin: 0;
  font-family: var(--fg-font-display);
  font-weight: var(--fg-weight-display);
  text-transform: uppercase;
  text-wrap: balance;
}

.fg-h1 {
  font-size: var(--fg-size-h1);
  letter-spacing: var(--fg-track-h1);
  line-height: var(--fg-leading-h1);
  max-width: 20em;
}

.fg-h2 {
  font-size: var(--fg-size-h2);
  font-weight: var(--fg-weight-ui);
  letter-spacing: var(--fg-track-h2);
  line-height: var(--fg-leading-h2);
  max-width: 22em;
}

.fg-lead {
  font-size: var(--fg-size-lead);
  line-height: 1.6;
  color: var(--fg-ink-2);
}

.fg-small {
  font-size: var(--fg-size-small);
}

.fg-label {
  font-family: var(--fg-font-ui);
  font-size: var(--fg-size-label);
  font-weight: var(--fg-weight-ui);
  letter-spacing: var(--fg-track-label);
  text-transform: uppercase;
  line-height: 1.4;
}

.fg-meta {
  font-size: var(--fg-size-small);
  font-variant-numeric: oldstyle-nums;
  color: var(--fg-ink-3);
}

.fg-caption {
  font-size: var(--fg-size-small);
  font-style: italic;
  color: var(--fg-ink-3);
}

.fg-muted {
  color: var(--fg-ink-2);
}

.fg-quiet {
  color: var(--fg-ink-3);
}

.fg-stack {
  /* one word per line, as on the reference */
  display: block;
}

.fg-stack span {
  display: block;
}

/* Vertical text for side labels and page numbers */
.fg-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

@media (max-width: 600px) {
  /* Wide tracking does not fit long words on a phone; tighten it. */
  .fg-h1 {
    font-size: 1.375rem;
    letter-spacing: 0.14em;
  }
  .fg-h2 {
    letter-spacing: 0.12em;
  }
  .fg-wordmark {
    letter-spacing: 0.24em;
  }
}

/* ---------- Rules ---------- */
.fg-rule {
  height: 0;
  margin: 0;
  border: 0;
  border-top: var(--fg-hairline) solid var(--fg-line);
}

.fg-rule--strong {
  border-top-color: var(--fg-line-strong);
}

.fg-rule--short {
  width: var(--fg-space-7);
}

.fg-rule-v {
  /* the vertical hairline that stands beside a hero title */
  width: 0;
  border-left: var(--fg-hairline) solid currentColor;
  opacity: 0.6;
}

/* ---------- Links ---------- */
.fg-link {
  text-decoration: underline;
  text-decoration-thickness: var(--fg-hairline);
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: text-decoration-color var(--fg-dur-fast) var(--fg-ease);
}

.fg-link:hover {
  text-decoration-color: currentColor;
}

/* Tracked label link, e.g. "See the approach" */
.fg-link-label {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-3);
  font-family: var(--fg-font-ui);
  font-size: var(--fg-size-label);
  letter-spacing: var(--fg-track-label);
  text-transform: uppercase;
}

.fg-link-label::after {
  content: "";
  width: var(--fg-space-6);
  height: var(--fg-hairline);
  background: currentColor;
  transition: width var(--fg-dur-fast) var(--fg-ease);
}

.fg-link-label:hover::after {
  width: var(--fg-space-7);
}

/* ---------- Buttons ---------- */
.fg-btn,
.fg a.fg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fg-space-3);
  min-height: 2.75rem;
  padding: 0 var(--fg-space-5);
  border: var(--fg-hairline) solid var(--fg-ink);
  border-radius: var(--fg-radius);
  background: var(--fg-ink);
  color: var(--fg-paper);
  font-family: var(--fg-font-ui);
  font-size: var(--fg-size-label);
  font-weight: var(--fg-weight-ui);
  letter-spacing: var(--fg-track-label);
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--fg-dur-fast) var(--fg-ease),
    color var(--fg-dur-fast) var(--fg-ease);
}

.fg-btn:hover,
.fg a.fg-btn:hover {
  background: var(--fg-paper);
  color: var(--fg-ink);
}

.fg-btn--ghost,
.fg a.fg-btn--ghost {
  background: transparent;
  color: var(--fg-ink);
}

.fg-btn--ghost:hover,
.fg a.fg-btn--ghost:hover {
  background: var(--fg-ink);
  color: var(--fg-paper);
}

.fg-btn--on-photo,
.fg a.fg-btn--on-photo {
  border-color: var(--fg-white);
  background: transparent;
  color: var(--fg-white);
}

.fg-btn--on-photo:hover,
.fg a.fg-btn--on-photo:hover {
  background: var(--fg-white);
  color: var(--fg-ink);
}

.fg-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Wordmark and seal ---------- */
.fg-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: var(--fg-space-4);
  font-family: var(--fg-font-display);
  font-weight: var(--fg-weight-ui);
  letter-spacing: var(--fg-track-wordmark);
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.fg-wordmark .fg-wordmark__name {
  font-size: 0.875rem;
}

.fg-wordmark .fg-wordmark__desc {
  font-size: var(--fg-size-micro);
  letter-spacing: var(--fg-track-label);
  opacity: 0.7;
}

/* Stacked version for heroes and covers */
.fg-wordmark--stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  font-weight: var(--fg-weight-display);
}

.fg-wordmark--stacked .fg-wordmark__name {
  font-size: var(--fg-size-h1);
  line-height: var(--fg-leading-h1);
}

.fg-wordmark--stacked .fg-wordmark__dash {
  display: block;
  width: 1em;
  height: var(--fg-hairline);
  margin: 0.55em 0;
  background: currentColor;
  font-size: var(--fg-size-h1);
}

.fg-wordmark--stacked .fg-wordmark__desc {
  font-size: var(--fg-size-label);
  line-height: 2;
  opacity: 0.8;
}

.fg-seal {
  display: inline-flex;
  align-items: center;
  gap: var(--fg-space-3);
  color: inherit;
}

.fg-seal__disc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: currentColor;
}

.fg-seal__glyph {
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", "Songti SC", "Noto Serif CJK SC", serif;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: 0.05em;
  writing-mode: vertical-rl;
  color: var(--fg-paper);
}

.fg-seal__text {
  font-family: var(--fg-font-ui);
  font-size: var(--fg-size-micro);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  line-height: 1;
  opacity: 0.8;
}

.fg-seal--lg .fg-seal__disc {
  width: 4rem;
  height: 4rem;
}

.fg-seal--lg .fg-seal__glyph {
  font-size: 1.2rem;
}

/* ---------- Layout ---------- */
.fg-page {
  width: 100%;
  max-width: var(--fg-max);
  margin: 0 auto;
  padding-left: var(--fg-gutter);
  padding-right: var(--fg-gutter);
}

.fg-section {
  padding-top: var(--fg-section);
  padding-bottom: var(--fg-section);
}

.fg-section--night {
  background: var(--fg-night);
  color: var(--fg-white);
}

.fg-section--night .fg-lead,
.fg-section--night .fg-meta,
.fg-section--night .fg-caption {
  color: var(--fg-white-2);
}

.fg-section--night .fg-rule {
  border-top-color: var(--fg-white-line);
}

.fg-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--fg-gap);
  row-gap: var(--fg-space-7);
}

/* Column helpers: .fg-col-{span} sets the span, .fg-col-start-{n} the start line; they combine. */
.fg-col-2 { grid-column-end: span 2; }
.fg-col-3 { grid-column-end: span 3; }
.fg-col-4 { grid-column-end: span 4; }
.fg-col-5 { grid-column-end: span 5; }
.fg-col-6 { grid-column-end: span 6; }
.fg-col-7 { grid-column-end: span 7; }
.fg-col-8 { grid-column-end: span 8; }
.fg-col-9 { grid-column-end: span 9; }
.fg-col-10 { grid-column-end: span 10; }
.fg-col-12 { grid-column-end: span 12; }
.fg-col-start-2 { grid-column-start: 2; }
.fg-col-start-3 { grid-column-start: 3; }
.fg-col-start-4 { grid-column-start: 4; }
.fg-col-start-5 { grid-column-start: 5; }
.fg-col-start-7 { grid-column-start: 7; }

@media (max-width: 900px) {
  .fg-grid > [class*="fg-col-"] {
    grid-column: 1 / -1;
  }
}

/* ---------- Photo ---------- */
.fg-photo {
  position: relative;
  overflow: hidden;
  background: var(--fg-photo);
  aspect-ratio: var(--fg-ratio-still);
}

.fg-photo--hero { aspect-ratio: var(--fg-ratio-hero); }
.fg-photo--wide { aspect-ratio: var(--fg-ratio-wide); }
.fg-photo--tall { aspect-ratio: var(--fg-ratio-tall); }
.fg-photo--square { aspect-ratio: 1; }

.fg-photo > img,
.fg-photo > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fg-photo--scrim::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fg-scrim);
  pointer-events: none;
}

/* Full-bleed photo that ignores the page gutter */
.fg-bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.fg-figure {
  margin: 0;
}

.fg-figure figcaption {
  display: flex;
  align-items: center;
  gap: var(--fg-space-4);
  margin-top: var(--fg-space-3);
}

.fg-figure figcaption::before {
  content: "";
  width: var(--fg-space-6);
  height: var(--fg-hairline);
  background: currentColor;
  opacity: 0.4;
}

/* Rendering disclosure, required until there is a built project */
.fg-render-tag {
  position: absolute;
  right: var(--fg-space-4);
  bottom: var(--fg-space-4);
  padding: var(--fg-space-1) var(--fg-space-2);
  background: rgba(10, 14, 12, 0.55);
  color: var(--fg-white-2);
  font-family: var(--fg-font-ui);
  font-size: var(--fg-size-micro);
  letter-spacing: var(--fg-track-label);
  text-transform: uppercase;
}

/* ---------- Navigation ---------- */
.fg-nav {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--fg-space-6);
  padding-top: var(--fg-space-6);
  padding-bottom: var(--fg-space-6);
}

.fg-nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fg-space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fg-nav__links a {
  display: inline-block;
  padding-bottom: 0.4em;
  border-bottom: var(--fg-hairline) solid transparent;
  transition: border-color var(--fg-dur-fast) var(--fg-ease);
}

.fg-nav__links a:hover,
.fg-nav__links a[aria-current="page"] {
  border-bottom-color: currentColor;
}

.fg-nav__aside {
  display: flex;
  align-items: center;
  gap: var(--fg-space-6);
}

.fg-nav__aside p {
  max-width: 22em;
  font-size: var(--fg-size-small);
  color: var(--fg-ink-2);
}

/* Nav laid over a photo */
.fg-nav--on-photo {
  color: var(--fg-white);
}

.fg-nav--on-photo .fg-nav__aside p {
  color: var(--fg-white-2);
}

@media (max-width: 900px) {
  .fg-nav {
    grid-template-columns: 1fr;
  }
  .fg-nav__aside p {
    display: none;
  }
}

/* ---------- Hero ---------- */
.fg-hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  color: var(--fg-white);
  background: var(--fg-photo);
  isolation: isolate;
}

.fg-hero__photo {
  position: absolute;
  inset: 0;
  z-index: -1;
  aspect-ratio: auto;
}

.fg-hero__body {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--fg-space-6);
  align-content: center;
  padding-top: var(--fg-space-9);
  padding-bottom: var(--fg-space-9);
}

.fg-hero__body .fg-rule-v {
  align-self: stretch;
}

.fg-hero__copy {
  display: grid;
  gap: var(--fg-space-6);
}

.fg-hero__copy p {
  max-width: var(--fg-measure-narrow);
  font-size: var(--fg-size-small);
  line-height: 1.75;
  color: var(--fg-white-2);
}

.fg-hero__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--fg-space-6);
  padding-bottom: var(--fg-space-6);
  color: var(--fg-white-2);
}

.fg-hero__index {
  position: absolute;
  top: 50%;
  right: var(--fg-gutter);
  transform: translateY(-50%);
  font-size: var(--fg-size-small);
  font-variant-numeric: tabular-nums;
  color: var(--fg-white-2);
}

/* ---------- Entry (date + title left, photo right) ---------- */
.fg-entry {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--fg-gap);
  align-items: start;
}

.fg-entry__meta {
  grid-column: 1 / span 3;
  display: grid;
  gap: var(--fg-space-3);
  align-content: start;
  padding-top: var(--fg-space-2);
}

.fg-entry__meta .fg-h2 {
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--fg-font-text);
  font-weight: var(--fg-weight-text);
  font-size: var(--fg-size-lead);
  line-height: 1.4;
}

.fg-entry__media {
  grid-column: 4 / -1;
}

.fg-entry--flip .fg-entry__meta {
  grid-column: 10 / -1;
  order: 2;
}

.fg-entry--flip .fg-entry__media {
  grid-column: 1 / span 9;
  order: 1;
}

.fg-entry + .fg-entry {
  margin-top: var(--fg-space-9);
}

@media (max-width: 900px) {
  .fg-entry__meta,
  .fg-entry__media,
  .fg-entry--flip .fg-entry__meta,
  .fg-entry--flip .fg-entry__media {
    grid-column: 1 / -1;
    order: initial;
  }
  .fg-entry__media {
    margin-top: var(--fg-space-4);
  }
}

/* ---------- Four-month strip ---------- */
.fg-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--fg-hairline);
  background: var(--fg-line);
}

.fg-strip > figure {
  margin: 0;
  background: var(--fg-paper);
}

.fg-strip .fg-photo {
  aspect-ratio: var(--fg-ratio-tall);
}

.fg-strip figcaption {
  padding: var(--fg-space-3) 0 0;
}

@media (max-width: 700px) {
  .fg-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Split screen (text one side, photo the other) ---------- */
.fg-split {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--fg-gap);
  row-gap: var(--fg-space-7);
  align-items: center;
}

.fg-split__text {
  grid-column: 1 / span 4;
  display: grid;
  gap: var(--fg-space-5);
}

.fg-split__media {
  grid-column: 6 / -1;
}

.fg-split--flip .fg-split__text {
  grid-column: 9 / -1;
  order: 2;
}

.fg-split--flip .fg-split__media {
  grid-column: 1 / span 7;
  order: 1;
}

@media (max-width: 900px) {
  .fg-split__text,
  .fg-split__media,
  .fg-split--flip .fg-split__text,
  .fg-split--flip .fg-split__media {
    grid-column: 1 / -1;
    order: initial;
  }
}

/* ---------- Forms ---------- */
.fg-form {
  display: grid;
  gap: var(--fg-space-6);
  max-width: 32rem;
}

.fg-field {
  display: grid;
  gap: var(--fg-space-2);
}

.fg-field > .fg-label {
  color: var(--fg-ink-2);
}

.fg-input,
.fg-textarea,
.fg-select {
  width: 100%;
  padding: var(--fg-space-3) 0;
  border: 0;
  border-bottom: var(--fg-hairline) solid var(--fg-ink-3);
  border-radius: 0;
  background: transparent;
  color: var(--fg-ink);
  font: inherit;
  font-size: var(--fg-size-lead);
  line-height: 1.4;
  transition: border-color var(--fg-dur-fast) var(--fg-ease);
}

.fg-input::placeholder,
.fg-textarea::placeholder {
  color: var(--fg-ink-3);
  font-style: italic;
}

.fg-input:focus,
.fg-textarea:focus,
.fg-select:focus {
  outline: none;
  border-bottom-color: var(--fg-ink);
}

.fg-textarea {
  min-height: 6rem;
  resize: vertical;
}

.fg-field__hint {
  font-size: var(--fg-size-small);
  color: var(--fg-ink-3);
}

.fg-field--error .fg-input,
.fg-field--error .fg-textarea {
  border-bottom-color: var(--fg-ink);
  border-bottom-width: 2px;
}

.fg-field--error .fg-field__hint {
  color: var(--fg-ink);
}

/* ---------- Footer ---------- */
.fg-footer {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--fg-gap);
  row-gap: var(--fg-space-6);
  padding-top: var(--fg-space-7);
  padding-bottom: var(--fg-space-7);
  border-top: var(--fg-hairline) solid var(--fg-line);
  font-size: var(--fg-size-small);
  color: var(--fg-ink-2);
}

.fg-footer > :nth-child(1) { grid-column: 1 / span 4; }
.fg-footer > :nth-child(2) { grid-column: 5 / span 4; }
.fg-footer > :nth-child(3) { grid-column: 9 / span 4; }

.fg-footer ul {
  display: grid;
  gap: var(--fg-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 900px) {
  .fg-footer > * {
    grid-column: 1 / -1 !important;
  }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .fg-rise {
    animation: fg-rise var(--fg-dur) var(--fg-ease) both;
  }
  .fg-rise--2 { animation-delay: 120ms; }
  .fg-rise--3 { animation-delay: 240ms; }
  .fg-rise--4 { animation-delay: 360ms; }

  @keyframes fg-rise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}

/* ---------- Utilities ---------- */
/* Scoped under .fg so they outrank the element resets above (.fg p, .fg h2 …). */
.fg .fg-mt-0 { margin-top: 0; }
.fg .fg-mt-2 { margin-top: var(--fg-space-2); }
.fg .fg-mt-4 { margin-top: var(--fg-space-4); }
.fg .fg-mt-6 { margin-top: var(--fg-space-6); }
.fg .fg-mt-7 { margin-top: var(--fg-space-7); }
.fg .fg-mt-8 { margin-top: var(--fg-space-8); }
.fg .fg-mt-9 { margin-top: var(--fg-space-9); }
.fg .fg-measure { max-width: var(--fg-measure); }
.fg .fg-measure-narrow { max-width: var(--fg-measure-narrow); }
.fg-on-photo { color: var(--fg-white); }
.fg-on-photo .fg-meta,
.fg-on-photo .fg-caption,
.fg-on-photo .fg-lead { color: var(--fg-white-2); }
.fg-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
