/* One section per screen: smaller elements, generous space around each section. Loaded last. */

.subnav { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: var(--space-4); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); }
.subnav button { min-height: 36px; padding: 0 var(--space-6); font: 500 .875rem "Marsa", Tahoma, sans-serif; color: var(--ink-muted); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.subnav button[aria-pressed="true"] { background: var(--port-blue); color: #fff; }
.view.off { display: none; }
.view > .sub:first-child { display: none; } /* the sub-navigation already names the view */

/* ===================== Computer ===================== */
@media (min-width: 761px) {
  :root { --header-h: 64px; }
  /* Type scales gently with the screen height: 14px on short laptops, 16px on tall screens. */
  html { font-size: clamp(14px, 1.85vh, 16px); }
  body { line-height: 1.65; }
  .header-row { min-height: var(--header-h); }
  .brand .logo-disc img { width: 40px; height: 40px; }

  main > .section { display: flex; flex-direction: column; justify-content: center; min-height: calc(100vh - var(--header-h)); min-height: calc(100svh - var(--header-h)); padding-block: 32px; }
  .wrap { width: min(1080px, 100% - 48px); }
  .section-head { margin-bottom: var(--space-4); padding-bottom: var(--space-2); }
  .section-head h2 { font-size: 1.5rem; margin: 0; }
  .section-head span { font-size: .8125rem; }
  h3 { font-size: 1rem; margin-bottom: var(--space-2); }
  p { margin-bottom: 12px; }
  .sub { font-size: 1rem; margin-top: var(--space-4); }
  .note { font-size: .8125rem; margin: var(--space-2) 0 0; }
  .btn { min-height: 40px; padding: 4px var(--space-4); font-size: .875rem; }
  .card { padding: var(--space-4); }

  /* Introduction */
  #intro .prose { max-width: 62em; }
  .big { font-size: 1.125rem; line-height: 1.75; margin-bottom: var(--space-2); }
  .prose p:not(.big) { font-size: .9375rem; }
  .values { gap: 12px; margin-block: var(--space-4); }
  .values li { padding: 12px var(--space-4); border-top-width: 3px; }
  .values p, .principle p { font-size: .8125rem; line-height: 1.7; }
  .principles { gap: 12px; }
  .principle { padding: 12px var(--space-4); }
  .principle h3 { margin-bottom: 4px; }

  /* Problems and solutions */
  #cases .note { margin: 0; }
  .tabs { margin-block: var(--space-2) 12px; }
  .tabs button { min-height: 36px; font-size: .8125rem; }
  .case { margin: 0; }
  .case > h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .compare { gap: var(--space-4); }
  .side { gap: 4px; }
  .tag { align-self: flex-start; font-size: .75rem; padding: 0 12px; }
  .mock { min-height: 230px; padding: var(--space-4); }
  .mock p { margin-bottom: var(--space-2); }
  .bn-title { font-size: 1.5rem; }
  .bn-body { font-size: 1rem; }
  .mock-title { font-size: 1rem; }
  .doc-head { gap: 12px; padding-bottom: var(--space-2); margin-bottom: var(--space-2); }
  .doc-head img { width: 44px; height: 44px; }
  .doc-title { font-size: 1rem; }
  .mock .doc-meta { margin-top: var(--space-2); }
  .line-skel { margin-bottom: 12px; }
  .data th, .data td { padding: 4px 12px; }
  .field { margin-bottom: var(--space-2); }
  .input { padding: 2px 12px; }
  .wf-head { margin-bottom: var(--space-2); }
  .wayfinding li { padding-block: 4px; }
  .wayfinding i { font-size: 1.5rem; }
  .bad-logos img { width: 80px; height: 80px; }
  .verdict { gap: 12px; margin-top: 12px; }
  .verdict > div { padding: var(--space-2) var(--space-4); border-top-width: 3px; }
  .verdict dd { font-size: .8125rem; line-height: 1.7; margin-top: 2px; }

  /* Impression */
  .switch { margin-bottom: var(--space-4); }
  .switch button { min-height: 36px; font-size: .8125rem; }
  .journey { gap: 12px; }
  .journey li { padding: var(--space-4) 12px; }
  .journey li::before { width: 32px; height: 32px; margin-bottom: var(--space-2); }
  .journey p { font-size: .875rem; }
  .journey q { margin-top: 12px; font-size: .8125rem; }

  /* Logo */
  .logo-stage { padding: var(--space-6); }
  .logo-stage img { width: min(210px, 32vh); }
  .rules { margin-bottom: var(--space-4); }
  .rules li { margin-bottom: 4px; }
  .grid-3, .grid-4 { gap: 12px; }
  .bg-demo, .dont { gap: var(--space-2); padding: 12px var(--space-2); }
  .bg-demo > img { margin: var(--space-2); width: 80px; height: 80px; }
  .logo-disc.logo-disc-fit { margin: 6px; }
  .logo-disc-fit img { width: 80px; height: 80px; }
  .dont > span { min-height: 88px; }
  .dont img { width: 76px; height: 76px; }
  .dont .x-crop { width: 76px; height: 44px; }

  /* Colour */
  .swatches { gap: 12px; margin-top: var(--space-2); }
  .chip { height: 56px; }
  .swatches p { font-size: .75rem; line-height: 1.6; margin-top: 4px; }
  .copy-status { min-height: 24px; margin: 4px 0 0; font-size: .875rem; }

  /* Type: introduction beside the scale */
  #type .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 0 var(--space-8); align-items: center; }
  #type .section-head { grid-column: 1 / -1; }
  .type-intro { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); margin: 0; }
  .glyphs { font-size: 3rem; line-height: 1.35; }
  .scale { padding: 0 var(--space-4); }
  .scale li { grid-template-columns: 104px 1fr; padding-block: 6px; }
  .meta { font-size: .8125rem; line-height: 1.5; }
  .ts-display { font-size: 2rem; line-height: 2.75rem; }
  .ts-h1 { font-size: 1.625rem; line-height: 2.25rem; }
  .ts-h2 { font-size: 1.25rem; line-height: 1.875rem; }
  .ts-h3 { font-size: 1rem; line-height: 1.5rem; }

  /* Spacing, writing, rollout */
  .grid-2 { gap: var(--space-4); }
  .spaces li { padding-block: 6px; }
  .spaces, .radii { margin-bottom: var(--space-4); }
  .radii i { width: 80px; height: 44px; }
  .say { padding: var(--space-4); }
  .steps li { grid-template-columns: 48px 210px 1fr; padding-block: var(--space-2); }
  .steps li::before { font-size: 1.125rem; }
  .download-band { padding: var(--space-4) var(--space-6); margin-top: var(--space-4); }

  /* Word templates */
  .word-layout { margin-top: 0; gap: var(--space-4); grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
  #templates .prose { font-size: .9375rem; }
  #word-form { padding: var(--space-4); }
  fieldset { margin-bottom: var(--space-2); }
  legend { font-size: .875rem; margin-bottom: 4px; }
  .choices label > span { min-height: 36px; padding: 2px var(--space-2); font-size: .8125rem; line-height: 1.5; }
  .wf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; }
  .wf-field:first-child { grid-column: span 3; }
  .wf-field label { font-size: .75rem; }
  .wf-field input { min-height: 34px; padding: 2px var(--space-2); font-size: .875rem; }

  /* AI toolkit */
  #ai .prose { font-size: .9375rem; margin-bottom: 0; }
  .ai-safety { margin-top: 12px; padding: var(--space-2) var(--space-4); }
  .ai-safety h3 { margin-bottom: 0; }
  .ai-safety ul { font-size: .8125rem; margin: 0; }
  .kit { margin-top: 12px; gap: 12px; }
  .kit p { font-size: .8125rem; }
  .core-details { margin-top: var(--space-2); }
  .core-details pre { max-height: 180px; }
  .filters { margin-block: var(--space-2) 12px; }
  .filters button { min-height: 34px; padding: 0 var(--space-4); font-size: .8125rem; }
  .prompt-list { gap: var(--space-2); }
  .prompt { padding: var(--space-2) 12px; }
  .prompt-group, .prompt > p { display: none; }
  .prompt h3 { margin: 0; font-size: .875rem; }
  .prompt summary { min-height: 28px; font-size: .75rem; }
  .prompt pre { max-height: 130px; }
  .prompt .btn { min-height: 34px; font-size: .8125rem; }
}
@media (min-width: 901px) {
  .prompt-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .swatches { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ===================== Phone ===================== */
@media (max-width: 760px) {
  main > .section { display: flex; flex-direction: column; justify-content: center; min-height: calc(100vh - var(--header-h) - var(--tabbar-h)); min-height: calc(100svh - var(--header-h) - var(--tabbar-h)); padding-block: 24px; }
  main > .section > .wrap { width: 100%; }
  body { font-size: .875rem; line-height: 26px; }
  h2 { font-size: 1.1875rem; }
  .section-head { margin-bottom: 12px; }
  .subnav { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
  .subnav button { min-height: 44px; padding: 0 var(--space-2); font-size: .8125rem; }
  .btn { min-height: 44px; font-size: .875rem; }
  .sub { margin-top: var(--space-4); font-size: .9375rem; }

  /* Introduction: values and principles in compact grids */
  .big { font-size: .9375rem; line-height: 28px; margin-bottom: 0; }
  html.js .more-text { font-size: .8125rem; }
  .values { grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-block: 12px; padding: 0; background: transparent; }
  .values li, .values li + li { padding: var(--space-2) 12px; background: #fff; border: 0; border-radius: var(--radius-md); }
  .values h3 { font-size: .875rem; margin: 0; }
  .values p { font-size: .75rem; line-height: 20px; }
  .principles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
  .principle { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: var(--space-2) 4px; text-align: center; }
  .principle h3 { margin: 0; font-size: .75rem; line-height: 20px; }
  .principle p { display: none; }

  /* Cases: "before" shows the problem; "after" shows the solution and its effect */
  #cases .note { display: none; }
  .tabs { margin-block: 0 var(--space-2); padding-block: var(--space-2); }
  .seg { margin-bottom: var(--space-2); }
  .mock { min-height: 200px; padding: 12px; }
  .mock p { margin-bottom: var(--space-2); font-size: .8125rem; line-height: 24px; }
  .mock .bn-title { font-size: 1.25rem; }
  .mock .bn-body { font-size: .9375rem; }
  .mock .mock-title, .mock .doc-title { font-size: .9375rem; }
  .doc-head { padding-bottom: var(--space-2); margin-bottom: var(--space-2); }
  .doc-head img { width: 40px; height: 40px; }
  .field { margin-bottom: var(--space-2); }
  .input { padding: 4px 12px; font-size: .75rem; }
  .wayfinding li { padding-block: 4px; }
  .ids { font-size: 1.375rem; }
  .verdict { margin-top: var(--space-2); }
  .verdict > div { padding: var(--space-2) 12px; }
  .verdict dd { font-size: .8125rem; line-height: 24px; margin-top: 0; }
  .case[data-side="before"] .verdict > div:not(:first-child), .case[data-side="after"] .verdict > div:first-child { display: none; }

  /* Impression */
  #impression .view > .prose { display: none; }
  .switch { margin-block: 0 var(--space-2); }
  .journey { gap: var(--space-2); }
  .journey li { padding: var(--space-2) 12px; }
  .journey li::before { width: 28px; height: 28px; }
  .journey li { grid-template-columns: 28px minmax(0, 1fr); }
  .journey h3 { font-size: .875rem; }
  .journey p { font-size: .75rem; line-height: 20px; }
  .journey q { margin-top: 4px; padding: 2px var(--space-2); font-size: .75rem; }
  .impact tr { margin-bottom: var(--space-2); padding: var(--space-2) 12px; }
  .impact td { font-size: .75rem; line-height: 20px; grid-template-columns: 118px minmax(0, 1fr); }
  .data.impact th[scope="row"] { margin: 0; font-size: .8125rem; }
  #impression .note { display: none; }

  /* Logo */
  .logo-intro { gap: 12px; }
  .logo-intro > div:last-child > p { display: none; }
  .logo-stage { padding: var(--space-4); }
  .logo-stage img { width: 128px; }
  .rules { margin-bottom: 12px; font-size: .8125rem; line-height: 24px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dont { padding-block: var(--space-2); }
  .dont > span { min-height: 72px; }
  .dont img { width: 60px; height: 60px; }
  .dont .x-crop { width: 60px; height: 35px; }

  /* Colour: two columns of tiles */
  #colour .prose { font-size: .75rem; line-height: 22px; margin-bottom: var(--space-2); }
  .swatches { grid-template-columns: 1fr 1fr; gap: var(--space-2); margin: 0; background: transparent; }
  .swatches li, .swatches li + li { padding: 6px; background: #fff; border: 0; border-radius: var(--radius-md); }
  .swatches button { grid-template-columns: 40px minmax(0, 1fr); column-gap: var(--space-2); min-height: 48px; }
  .swatches .chip { width: 40px; height: 44px; }
  .swatches b { font-size: .75rem; line-height: 20px; }
  .swatches code { font-size: .625rem; line-height: 16px; white-space: normal; }
  .swatches p { display: none; }
  #colour .data th, #colour .data td { padding: 4px; font-size: .75rem; }

  /* Type */
  #type .type-intro > div > p:nth-of-type(2) { display: none; }
  #type .type-intro p { font-size: .8125rem; line-height: 24px; }
  .glyphs { font-size: 1.75rem; }
  .scale li { padding-block: 4px; }
  .meta { font-size: .6875rem; line-height: 18px; }
  .ts-display { font-size: 1.25rem; line-height: 32px; }
  .ts-h1 { font-size: 1.125rem; line-height: 30px; }
  .ts-h2 { font-size: 1rem; line-height: 28px; }
  .ts-h3, .ts-body { font-size: .875rem; line-height: 24px; }

  /* Spacing, writing, rollout */
  #shape .card { padding: 12px; }
  .spaces, .radii { margin-bottom: var(--space-2); }
  .spaces li { padding-block: 2px; }
  .spaces span { font-size: .75rem; line-height: 20px; }
  #shape .card p { display: none; }
  #writing .rules { font-size: .75rem; line-height: 22px; }
  .say { padding: var(--space-2) 12px; }
  .say figcaption { margin: 0; }
  .say p { font-size: .8125rem; }
  .steps li { padding-block: var(--space-2); }
  .steps b { font-size: .875rem; }
  .steps span { font-size: .75rem; line-height: 20px; }
  .download-band { gap: var(--space-2); padding: var(--space-4); }

  /* Word templates: two fields per row */
  #templates .prose { font-size: .75rem; line-height: 22px; margin-bottom: var(--space-2); }
  .word-layout { margin: 0; }
  #word-form { padding: 12px; }
  fieldset { margin-bottom: var(--space-2); }
  legend { font-size: .8125rem; margin-bottom: 4px; }
  .choices label > span { min-height: 44px; font-size: .75rem; }
  .choices small { display: none; }
  .wf-grid { grid-template-columns: 1fr 1fr; gap: 4px var(--space-2); }
  .wf-field label { font-size: .75rem; line-height: 20px; }
  .wf-field input { min-height: 44px; padding: 4px var(--space-2); }

  /* AI toolkit */
  #ai .view > .prose { font-size: .75rem; line-height: 22px; margin: 0; }
  .ai-safety { margin-top: var(--space-2); padding: var(--space-2) 12px; }
  .ai-safety h3 { margin: 0; font-size: .875rem; }
  .ai-safety ul { font-size: .6875rem; line-height: 20px; margin: 0; }
  .kit { grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-top: var(--space-2); }
  .kit .card { padding: 12px; }
  .kit .card p { display: none; }
  .kit h3 { font-size: .8125rem; margin-bottom: var(--space-2); }
  .kit .btn { padding: 4px; font-size: .75rem; }
  #ai .note { display: none; }
  .filters { margin-block: 0 var(--space-2); }
  .prompt-list { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .prompt { padding: var(--space-2); }
  .prompt > p, .prompt details { display: none; }
  .prompt h3 { flex: 1; margin-bottom: 4px; font-size: .75rem; line-height: 20px; }
  .prompt .btn { padding: 4px; font-size: .75rem; }
}

@media print {
  .subnav { display: none; }
  .view.off { display: block; }
  main > .section { display: block; min-height: 0; }
}

/* ===== Final trims so that each view fits ===== */
@media (min-width: 761px) and (max-height: 660px) {
  main > .section { padding-block: 12px; }
  #templates .prose { display: none; }
}
@media (max-width: 760px) {
  /* Phones show what the client feels and thinks; the measuring method is for larger screens. */
  .impact td:nth-of-type(3) { display: none; }
  #templates .view > .prose { display: none; }
  .prompt-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prompt h3 { text-align: center; }
  .prompt .btn { font-size: .6875rem; padding-inline: 2px; }
}
/* Short phones */
@media (max-width: 760px) and (max-height: 780px) {
  main > .section { padding-block: 12px; }
  .section-head { margin-bottom: var(--space-2); }
  .subnav { margin-bottom: var(--space-2); }
  .mock { min-height: 164px; }
  .glyphs { display: none; }
  #ai .view > .prose { display: none; }
  /* Group titles stay available to screen readers. */
  #word-form legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #word-form fieldset { margin-bottom: 12px; }
}
@media (max-width: 760px) {
  .mock { min-height: 150px; }
  .verdict dd { line-height: 22px; }
  .verdict > div { padding-block: 6px; }
  #cases .section-head { margin-bottom: var(--space-2); }
}
@media (max-width: 760px) and (max-height: 780px) {
  .mock { min-height: 0; padding: var(--space-2) 12px; }
  .mock p { margin-bottom: 4px; line-height: 22px; }
  .doc-head img { width: 32px; height: 32px; }
  .scale li { padding-block: 2px; }
}

/* Journey: the quote boxes sit on one horizontal line, with equal height, whatever the text length. */
@media (min-width: 761px) {
  .journey li { display: flex; flex-direction: column; }
  .journey li::before { flex: none; }
  .journey li > p { flex: 1; display: flex; flex-direction: column; }
  .journey q { display: flex; align-items: center; justify-content: center; min-height: 3.6rem; margin-top: auto; text-align: center; }
  .journey li > p > q { margin-top: auto; }
  .journey q::before { content: open-quote; }
  .journey q::after { content: close-quote; }
}

/* Phones: sections take their natural height, with one consistent gap between them.
   (Replaces the earlier full-screen sections, which left large empty areas on phones.) */
@media (max-width: 760px) {
  main > .section { display: block; min-height: 0; padding-block: 28px; }
}

/* ===== Copy confirmation: calm and brief ===== */
.prompt .btn, #copy-core { position: relative; }
.copied-mark { position: absolute; inset: 0; border-radius: inherit; display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--port-blue-soft); color: var(--port-blue); white-space: nowrap; font-weight: 700; opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .28s cubic-bezier(.2, .7, .2, 1); pointer-events: none; }
.copied-mark svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.copied-mark path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.btn.is-copied .copied-mark { opacity: 1; transform: none; }
.btn.is-copied .copied-mark path { animation: draw-check .35s .18s ease-out forwards; }
.btn.is-copied { border-color: var(--port-blue); }
@keyframes draw-check { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .copied-mark { transition: none; transform: none; }
  .btn.is-copied .copied-mark path { animation: none; stroke-dashoffset: 0; }
}

/* ===== Phone: lighter buttons in the AI section and the section switchers =====
   The visible button is smaller; an invisible margin keeps the touch area close to 44px. */
@media (max-width: 760px) {
  .subnav { padding: 3px; }
  .subnav button, #ai .filters button, #ai .prompt .btn, #ai .kit .btn { position: relative; min-height: 32px; line-height: 20px; }
  .subnav button::after, #ai .filters button::after, #ai .kit .btn::after, #ai .prompt .btn::after { content: ""; position: absolute; inset: -6px 0; }
  .subnav button { font-size: .75rem; }
  #ai .filters { gap: 6px; }
  #ai .filters button { font-size: .75rem; padding-block: 2px; }
  #ai .kit .btn { font-size: .6875rem; padding: 4px; }
  #ai .prompt-list { align-items: stretch; }
  #ai .prompt .btn { align-self: center; width: 100%; max-width: 96px; min-height: 30px; padding: 3px 4px; font-size: .6875rem; border-radius: 6px; }
  /* Room around the copy button for its enlarged touch area. */
  #ai .prompt .btn { margin-block: 6px 4px; }
  #ai .prompt .copied-mark { gap: 3px; }
  #ai .prompt .copied-mark svg { width: 13px; height: 13px; }
}
