/* ==========================================================================
   Memoptimizer - shared stylesheet
   Fonts: Barlow Condensed (display) + Nunito (body), loaded from Google Fonts
   Palette: ivory ground, teal accent. Light theme only.
   Mobile first: base rules are for a 360px screen, wider layouts layer on at
   480px, 768px and 1024px.
   ========================================================================== */

:root {
  color-scheme: only light;

  --bg: #FFFDF7;
  --surface: #F2EEE3;
  --ink: #16302B;
  --muted: #5B6F6A;
  --accent: #0F766E;
  --accent-ink: #FFFFFF;
  --accent-deep: #0B5A54;
  --accent-soft: #E3F1EE;
  --rule: rgba(91, 111, 106, 0.4);

  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --radius: 6px;
  --gutter: clamp(16px, 5vw, 40px);
  --chapter-pad: clamp(48px, 9vw, 96px);
  --measure: 680px;
}

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

html {
  background-color: #FFFDF7;
  color: #16302B;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.is-publication {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* Thin accent bar at the very top of the viewport */
body.is-publication::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
  z-index: 100;
}

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

img,
video {
  display: block;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

a:hover {
  color: var(--accent-deep);
}

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

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

/* --------------------------------------------------------------------------
   Masthead: wordmark and label on one line, nothing else
   -------------------------------------------------------------------------- */
.masthead {
  background-color: var(--bg);
  color: var(--ink);
  padding-block: 22px 8px;
}

.masthead-inner {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 44px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

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

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.01em;
}

.masthead-sep {
  color: var(--muted);
  font-weight: 700;
  flex: 0 0 auto;
}

.masthead-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Opening: pure typography
   -------------------------------------------------------------------------- */
.opening {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "kicker"
    "title"
    "byline"
    "dek"
    "copy";
  padding-block: clamp(28px, 6vw, 64px) clamp(32px, 6vw, 56px);
}

.kicker {
  grid-area: kicker;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1875rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  background-color: var(--accent);
}

.opening-title {
  grid-area: title;
  margin: 0 0 20px;
  max-width: 17ch;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 1.2rem + 4.8vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.005em;
  text-align: left;
  text-wrap: balance;
}

.byline {
  grid-area: byline;
  align-self: start;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
}

.dek {
  grid-area: dek;
  margin: 0 0 28px;
  max-width: var(--measure);
  color: var(--ink);
  font-size: clamp(1.125rem, 1.02rem + 0.5vw, 1.3125rem);
  font-weight: 600;
  line-height: 1.55;
}

.opening-copy {
  grid-area: copy;
  max-width: var(--measure);
}

.opening-copy p {
  margin: 0 0 1.2em;
}

.opening-copy p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Figures, loops
   -------------------------------------------------------------------------- */
.hero-figure {
  margin: 0;
}

.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--surface);
  aspect-ratio: 4 / 3;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 74% 38%;
}

.hero-figure figcaption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-style: italic;
  line-height: 1.5;
  max-width: var(--measure);
}

.figure-inline {
  margin: 2rem 0;
}

.figure-inline .media-frame {
  aspect-ratio: 3 / 2;
}

.figure-inline .media-frame img {
  object-position: 62% 40%;
}

.loop {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--surface);
  aspect-ratio: 4 / 5;
}

.loop video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}

.loop--wide {
  aspect-ratio: 40 / 21;
  margin: 2rem 0;
}

.loop--wide video {
  object-position: 50% 40%;
}

/* --------------------------------------------------------------------------
   Store bar: one note, two store buttons
   -------------------------------------------------------------------------- */
.cta-slot {
  padding-block: clamp(8px, 2vw, 16px) clamp(40px, 7vw, 72px);
}

.store-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 2rem 0 0;
  padding: 20px;
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--ink);
}

.cta-slot .store-bar {
  margin-top: 0;
}

.store-bar .store-bar-note {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}

.store-bar-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.store-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 10px 18px;
  border-radius: var(--radius);
  background-color: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.store-btn:hover {
  background-color: var(--accent-deep);
  color: var(--accent-ink);
  transform: translateY(-1px);
}

.store-btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: var(--radius);
}

.store-btn-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1.25;
}

.store-btn-label .arrow {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}

.store-btn:hover .arrow {
  transform: translateX(3px);
}

.store-btn-sub {
  color: #DDEFEC;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   Chapters: H2 and notes on the left, prose and media on the right
   -------------------------------------------------------------------------- */
.chapter {
  background-color: var(--bg);
  color: var(--ink);
  border-top: 1px solid var(--rule);
  padding-block: var(--chapter-pad);
}

.chapter--tint {
  background-color: var(--surface);
}

.chapter-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "body";
  gap: 20px;
}

.chapter-head {
  grid-area: head;
  min-width: 0;
}

.chapter-body {
  grid-area: body;
  min-width: 0;
  max-width: var(--measure);
}

.chapter-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
}

.chapter--tint .chapter-note {
  color: var(--ink);
}

.chapter-note::before {
  content: "";
  width: 18px;
  height: 2px;
  background-color: var(--accent);
}

.chapter-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: 0;
  text-wrap: balance;
}

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

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

.step-label {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1875rem;
  letter-spacing: 0.02em;
}

.chapter--tint .step-label {
  color: var(--accent-deep);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  margin-block: 2rem;
}

.split:last-child {
  margin-bottom: 0;
}

.split-text {
  min-width: 0;
}

.split .loop {
  width: 100%;
  max-width: 420px;
}

.split-text p:last-child {
  margin-bottom: 0;
}

.prose .pullquote {
  margin: 2rem 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 1.2rem + 1.9vw, 2.375rem);
  line-height: 1.12;
  text-wrap: balance;
}

.checklist {
  margin: 2rem 0;
  padding: 22px 22px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background-color: var(--bg);
  color: var(--ink);
}

.checklist-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.625rem;
  line-height: 1.1;
}

.checklist-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist-items li {
  position: relative;
  padding: 12px 0 12px 34px;
  border-top: 1px solid var(--rule);
  line-height: 1.55;
}

.checklist-items li:first-child {
  border-top: 0;
}

.checklist-items li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 17px;
  width: 15px;
  height: 8px;
  border-left: 3px solid var(--accent);
  border-bottom: 3px solid var(--accent);
  transform: rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Footer: company -> links -> disclosure
   -------------------------------------------------------------------------- */
.base {
  background-color: var(--bg);
  color: var(--ink);
  border-top: 1px solid var(--rule);
  padding-block: 44px 56px;
}

.base .org {
  max-width: 820px;
}

.base .org p {
  margin: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.meta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
  margin: 18px 0 14px;
}

.meta-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.meta-links a:hover {
  color: var(--accent);
}

.imprint-line {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Legal and about pages: one continuous memorandum
   -------------------------------------------------------------------------- */
.legal-page {
  background-color: var(--bg);
  color: var(--ink);
}

.legal-head {
  padding-block: clamp(28px, 6vw, 64px) clamp(24px, 4vw, 40px);
}

.legal-title {
  margin: 0 0 14px;
  max-width: 16ch;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 1.3rem + 4vw, 3.75rem);
  line-height: 1.04;
  text-wrap: balance;
}

.dateline {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
}

.legal-body {
  border-top: 1px solid var(--rule);
  padding-block: clamp(32px, 6vw, 64px) clamp(56px, 9vw, 96px);
}

.memo {
  max-width: var(--measure);
  min-width: 0;
}

.memo h2 {
  margin: 2.2em 0 0.45em;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.125rem);
  line-height: 1.1;
}

.memo h2:first-child {
  margin-top: 0;
}

.memo p {
  margin: 0 0 1.15em;
}

.principles {
  list-style: none;
  margin: 1.6rem 0 2rem;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.principles li {
  position: relative;
  padding: 14px 0 14px 30px;
  border-bottom: 1px solid var(--rule);
  font-weight: 600;
  line-height: 1.5;
}

.principles li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 25px;
  width: 14px;
  height: 2px;
  background-color: var(--accent);
}

/* --------------------------------------------------------------------------
   480px
   -------------------------------------------------------------------------- */
@media (min-width: 480px) {
  .masthead-label {
    font-size: 0.875rem;
  }

  .brand-name {
    font-size: 1.75rem;
  }

  .store-bar-links {
    flex-direction: row;
  }

  .store-bar-links .store-btn {
    flex: 1 1 0;
  }

  .media-frame {
    aspect-ratio: 3 / 2;
  }
}

/* --------------------------------------------------------------------------
   768px
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .masthead {
    padding-block: 32px 12px;
  }

  .masthead-inner {
    gap: 10px;
  }

  .brand-name {
    font-size: 2rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .media-frame {
    aspect-ratio: 16 / 9;
  }

  .store-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 20px;
    padding: 22px 24px;
  }

  .store-bar .store-bar-note {
    flex: 1 1 150px;
    max-width: 210px;
    font-size: 0.9375rem;
  }

  .store-bar-links {
    flex: 0 0 auto;
  }

  .store-bar-links .store-btn {
    flex: 0 0 auto;
    padding-inline: 14px;
  }

  .store-btn-label {
    font-size: 1rem;
    gap: 6px;
  }

  .split {
    grid-template-columns: minmax(0, 1fr) 232px;
    gap: 36px;
    align-items: start;
  }

  .split--flip {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .split--flip .loop {
    order: -1;
  }

  .split .loop {
    aspect-ratio: 3 / 5;
    max-width: none;
  }

  .base {
    padding-block: 56px 72px;
  }
}

/* --------------------------------------------------------------------------
   1024px: asymmetric 12-column magazine grid
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  .opening {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
    grid-template-areas:
      "kicker kicker kicker kicker kicker kicker kicker kicker kicker kicker kicker kicker"
      "title  title  title  title  title  title  title  title  title  title  title  title"
      "byline byline byline byline dek    dek    dek    dek    dek    dek    dek    dek"
      "...... ...... ...... ...... copy   copy   copy   copy   copy   copy   copy   copy";
  }

  .opening-title {
    max-width: 20ch;
    margin-bottom: 32px;
  }

  .byline {
    margin-top: 8px;
    margin-bottom: 0;
  }

  .dek {
    margin-bottom: 32px;
  }

  .chapter-inner {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
    grid-template-areas:
      "head head head head body body body body body body body body";
    align-items: start;
  }

  .chapter-head {
    position: sticky;
    top: 32px;
    padding-right: 16px;
  }

  .cta-slot .store-bar {
    margin-left: calc((100% - 11 * 24px) / 12 * 4 + 4 * 24px);
  }

  .legal-head .legal-title {
    max-width: 18ch;
  }

  .legal-body .wrap {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
    grid-template-areas:
      "...... ...... ...... ...... memo   memo   memo   memo   memo   memo   memo   memo";
  }

  .legal-body .memo {
    grid-area: memo;
  }

  .split {
    grid-template-columns: minmax(0, 1fr) 248px;
  }

  .split--flip {
    grid-template-columns: 248px minmax(0, 1fr);
  }
}

@media (min-width: 1200px) {
  .opening-title {
    max-width: 22ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
