/* ==========================================================================
   Client portal
   An editorial document, not an app dashboard. The client's brand is the
   most colourful thing on the page.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Password gate
   -------------------------------------------------------------------------- */

.gate {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--space-24);
}
.gate-identifier { font-size: var(--size-12); letter-spacing: 0.04em; color: var(--ui-text-muted); }
.gate-main { display: flex; align-items: center; justify-content: center; }
.gate-panel { width: 100%; max-width: 420px; }
.gate-mark { margin-bottom: var(--space-32); max-height: 72px; }
.gate-mark svg { max-height: 72px; width: auto; }
.gate h1 { font-size: var(--size-28); }
.gate-sub { margin-top: var(--space-4); color: var(--ui-text-muted); }
.gate form { margin-top: var(--space-32); }
.gate-footer { font-size: var(--size-14); color: var(--ui-text-muted); }

.gate-state { max-width: 560px; }
.gate-state h1 { font-size: var(--size-28); }
.gate-state p { margin-top: var(--space-16); color: var(--ui-text-muted); }

/* --------------------------------------------------------------------------
   Portal shell
   -------------------------------------------------------------------------- */

.portal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ui-bg);
  border-bottom: 1px solid var(--ui-rule);
}

.portal-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-24);
  min-height: 64px;
  padding: var(--space-8) 0;
}

.portal-title { font-size: var(--size-16); font-weight: 600; }
.portal-meta { font-size: var(--size-12); color: var(--ui-text-muted); }

.portal-actions { display: flex; align-items: center; gap: var(--space-8); }

/* Anchor navigation : text links, weight plus rule for the active item. */
.portal-nav {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.portal-nav ul {
  display: flex;
  gap: var(--space-24);
  list-style: none;
  min-height: 44px;
  align-items: stretch;
}
.portal-nav a {
  display: flex;
  align-items: center;
  font-size: var(--size-14);
  color: var(--ui-text-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--motion-fast) var(--ease-move),
              border-color var(--motion-fast) var(--ease-move);
}
@media (hover: hover) and (pointer: fine) {
  .portal-nav a:hover { color: var(--ui-text); }
}
.portal-nav a[aria-current="true"] {
  color: var(--ui-text);
  font-weight: 600;
  border-bottom-color: var(--ui-text);
}

html { scroll-behavior: auto; }
:target, [id] { scroll-margin-top: 128px; }

/* --------------------------------------------------------------------------
   Sections : large editorial blocks separated by space and quiet rules.
   -------------------------------------------------------------------------- */

.brand-section { padding: var(--space-96) 0; border-top: 1px solid var(--ui-rule); }
.brand-section:first-of-type { border-top: 0; padding-top: var(--space-64); }

.section-head { max-width: 50vw; }
.section-head h2 { font-size: var(--size-28); }
.section-head p { margin-top: var(--space-12); color: var(--ui-text-muted); }
.section-body { margin-top: var(--space-48); }

.brand-lede {
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.35;
  letter-spacing: -0.015em;
  max-width: 24ch;
}

.brand-heading { font-size: var(--size-40); }

.overview-grid {
  display: grid;
  gap: var(--space-32) var(--space-48);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.principle h3 { font-size: var(--size-20); }
.principle p { margin-top: var(--space-8); color: var(--ui-text-muted); }

.quick-start { list-style: none; }
.quick-start li {
  padding: var(--space-12) 0;
  border-top: 1px solid var(--ui-rule);
}
.quick-start li:last-child { border-bottom: 1px solid var(--ui-rule); }

/* --------------------------------------------------------------------------
   Logo specimens : room to breathe, neutral canvas.
   -------------------------------------------------------------------------- */

.logo-record + .logo-record { margin-top: var(--space-64); padding-top: var(--space-64); border-top: 1px solid var(--ui-rule); }

.logo-layout {
  display: grid;
  gap: var(--space-32);
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  align-items: start;
}

.logo-canvas {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: var(--space-48);
  background: var(--ui-surface);
  border: 1px solid var(--ui-rule);
  border-radius: var(--radius-md);
}
.logo-canvas svg, .logo-canvas img { max-height: 200px; width: auto; max-width: 100%; }

.logo-detail h3 { font-size: var(--size-20); }
.logo-detail dl { margin: var(--space-24) 0 0; }
.logo-detail dt { font-size: var(--size-12); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ui-text-muted); }
.logo-detail dd { margin: var(--space-4) 0 var(--space-16); font-size: var(--size-14); }

/* --------------------------------------------------------------------------
   Colour : colour is content. Generous, flat swatches.
   -------------------------------------------------------------------------- */

.colour-grid {
  display: grid;
  gap: var(--space-32);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.colour-swatch {
  display: block;
  width: 100%;
  height: 160px;
  border: 1px solid var(--ui-rule);
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: border-color var(--motion-fast) var(--ease-move);
}
@media (hover: hover) and (pointer: fine) {
  .colour-swatch:hover { border-color: var(--ui-rule-strong); }
}
.colour-swatch-label {
  position: absolute;
  left: var(--space-12);
  bottom: var(--space-12);
  font-size: var(--size-12);
  font-family: var(--font-ui);
  opacity: 0;
  transition: opacity var(--motion-fast) var(--ease-move);
}
@media (hover: hover) and (pointer: fine) {
  .colour-swatch:hover .colour-swatch-label { opacity: 1; }
}
.colour-swatch:focus-visible .colour-swatch-label,
.colour-swatch[data-copied="true"] .colour-swatch-label { opacity: 1; }

.colour-name { margin-top: var(--space-16); font-size: var(--size-20); font-weight: 600; }
.colour-usage { margin-top: var(--space-8); font-size: var(--size-14); color: var(--ui-text-muted); }

.colour-values { margin-top: var(--space-12); }
.colour-values div {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: var(--space-8);
}
.colour-values dt { font-size: var(--size-12); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ui-text-muted); }
.colour-values dd { margin: 0; }

/* --------------------------------------------------------------------------
   Typography specimens
   -------------------------------------------------------------------------- */

.typeface + .typeface { margin-top: var(--space-64); padding-top: var(--space-48); border-top: 1px solid var(--ui-rule); }
.typeface-role { font-size: var(--size-12); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ui-text-muted); }
.typeface-family { margin-top: var(--space-4); font-size: var(--size-28); }
.typeface-specimen {
  margin-top: var(--space-24);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.typeface-glyphs { margin-top: var(--space-8); font-size: var(--size-20); color: var(--ui-text-muted); letter-spacing: 0.02em; }
.typeface-meta {
  margin-top: var(--space-24);
  display: grid;
  gap: var(--space-16) var(--space-32);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  max-width: 900px;
}
.typeface-meta dt { font-size: var(--size-12); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ui-text-muted); }
.typeface-meta dd { margin: var(--space-4) 0 0; font-size: var(--size-14); }

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */

.icon-grid {
  display: grid;
  gap: var(--space-16);
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.icon-item {
  border: 1px solid var(--ui-rule);
  border-radius: var(--radius-md);
  padding: var(--space-16);
  text-align: center;
}
.icon-canvas { display: grid; place-items: center; height: 88px; }
.icon-canvas svg, .icon-canvas img { max-height: 48px; max-width: 48px; width: auto; }
.icon-name { margin-top: var(--space-8); font-size: var(--size-14); font-weight: 600; }
.icon-usage { margin-top: var(--space-4); font-size: var(--size-12); color: var(--ui-text-muted); }
.icon-item .btn { margin-top: var(--space-12); }

/* --------------------------------------------------------------------------
   Imagery : real imagery at useful size, intentional aspect ratios kept.
   -------------------------------------------------------------------------- */

.image-list > * + * { margin-top: var(--space-48); }
.image-record img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  background: var(--ui-surface);
}
.image-caption {
  margin-top: var(--space-12);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-16);
}
.image-caption h3 { font-size: var(--size-16); }
.image-caption p { font-size: var(--size-14); color: var(--ui-text-muted); }

/* --------------------------------------------------------------------------
   Accessibility pairings
   -------------------------------------------------------------------------- */

.pairing-grid {
  display: grid;
  gap: var(--space-24);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.pairing {
  border: 1px solid var(--ui-rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.pairing-sample {
  padding: var(--space-24);
  font-size: var(--size-20);
  font-weight: 600;
}
.pairing-sample span { display: block; font-size: var(--size-14); font-weight: 400; margin-top: var(--space-4); }
.pairing-facts { padding: var(--space-16); border-top: 1px solid var(--ui-rule); }
.pairing-ratio { font-family: var(--font-mono); font-size: var(--size-20); font-variant-numeric: tabular-nums; }
.pairing-results { margin-top: var(--space-8); font-size: var(--size-14); }
.pairing-results div { display: flex; justify-content: space-between; gap: var(--space-16); padding: var(--space-4) 0; }
.pairing-results dt { color: var(--ui-text-muted); }
.pairing-results dd { margin: 0; font-weight: 600; }
.result-pass { color: var(--ui-success); }
.result-fail { color: var(--ui-danger); }
.pairing-notes { margin-top: var(--space-12); font-size: var(--size-14); color: var(--ui-text-muted); }

.avoid-list { list-style: none; margin-top: var(--space-24); }
.avoid-list li { padding: var(--space-12) 0; border-top: 1px solid var(--ui-rule); font-size: var(--size-14); }
.avoid-list li:last-child { border-bottom: 1px solid var(--ui-rule); }

/* --------------------------------------------------------------------------
   Assets : a curated library, not a filesystem.
   -------------------------------------------------------------------------- */

.asset-list { list-style: none; border-top: 1px solid var(--ui-rule); }
.asset-list li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: var(--space-16);
  align-items: center;
  padding: var(--space-16) 0;
  border-bottom: 1px solid var(--ui-rule);
}
.asset-preview {
  width: 72px; height: 56px;
  display: grid; place-items: center;
  background: var(--ui-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.asset-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset-preview span { font-size: var(--size-12); color: var(--ui-text-muted); font-weight: 600; }
.asset-name { font-weight: 600; font-size: var(--size-16); }
.asset-meta { font-size: var(--size-14); color: var(--ui-text-muted); }

/* --------------------------------------------------------------------------
   PNG export modal
   -------------------------------------------------------------------------- */

.export-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: var(--space-32);
  align-items: start;
}
.export-preview {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: var(--space-16);
  border: 1px solid var(--ui-rule);
  border-radius: var(--radius-md);
  background:
    repeating-conic-gradient(var(--ui-surface-strong) 0% 25%, var(--ui-bg) 0% 50%) 50% / 16px 16px;
}
.export-preview canvas { max-width: 100%; height: auto; }
.export-controls fieldset { border: 0; padding: 0; margin: 0 0 var(--space-24); }
.export-controls legend {
  padding: 0;
  font-size: var(--size-12);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ui-text-muted);
  margin-bottom: var(--space-8);
}
.option-row { display: flex; flex-wrap: wrap; gap: var(--space-8); }
.option {
  position: relative;
  display: inline-flex;
}
.option input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.option span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  min-height: 40px;
  padding: 0 var(--space-12);
  border: 1px solid var(--ui-rule-strong);
  border-radius: var(--radius-md);
  font-size: var(--size-14);
  transition: border-color var(--motion-fast) var(--ease-move),
              background-color var(--motion-fast) var(--ease-move);
}
.option input:checked + span { border-color: var(--ui-text); background: var(--ui-surface); font-weight: 600; }
.option input:focus-visible + span { outline: 3px solid var(--ui-accent); outline-offset: 2px; }
.option-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid var(--ui-rule-strong);
  flex: none;
}
.option-dot-transparent {
  background: repeating-conic-gradient(var(--ui-surface-strong) 0% 25%, #fff 0% 50%) 50% / 8px 8px;
}

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

.portal-footer {
  padding: var(--space-48) 0 var(--space-64);
  border-top: 1px solid var(--ui-rule);
  font-size: var(--size-14);
  color: var(--ui-text-muted);
}
.portal-footer .btn-row { margin-top: var(--space-16); }

/* Admin preview marker : outside the client content. */
.preview-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  padding: var(--space-8) var(--space-24);
  background: var(--ui-text);
  color: #fff;
  font-size: var(--size-14);
}
.preview-bar a { color: #fff; }
body.has-preview-bar .portal-header { top: 44px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .brand-section { padding: var(--space-64) 0; }
  .logo-layout { grid-template-columns: 1fr; }
  .export-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .brand-section { padding: var(--space-48) 0; }
  .section-body { margin-top: var(--space-32); }
  .colour-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .logo-canvas { min-height: 200px; padding: var(--space-24); }
  .asset-list li { grid-template-columns: 56px minmax(0, 1fr); row-gap: var(--space-8); }
  .asset-list li .btn { grid-column: 1 / -1; }
  .asset-preview { width: 56px; height: 48px; }
  .portal-header-top { min-height: 56px; }
}

@media (max-width: 380px) {
  .colour-grid { grid-template-columns: 1fr; }
}

/* Configurable brand manual: a quiet index beside an uninterrupted document. */
:root { --guide-ease: cubic-bezier(.76,0,.24,1); --guide-motion: 360ms; }
.guideline-shell { display:grid; grid-template-columns:240px minmax(0,1fr); align-items:start; }
.guide-rail { position:sticky; top:0; height:100dvh; overflow:auto; scrollbar-width:thin; overscroll-behavior:contain; border-right:1px solid var(--ui-rule); padding:32px 24px 24px; display:flex; flex-direction:column; background:var(--ui-bg); z-index:30; }
.guide-identity { padding-bottom:32px; }
.guide-wordmark { font-size:20px; font-weight:600; letter-spacing:-.03em; line-height:1.25; overflow-wrap:anywhere; }
.guide-mark { width:100%; height:72px; object-fit:contain; object-position:left center; margin-bottom:20px; }
.guide-label { font-size:11px; text-transform:uppercase; letter-spacing:.14em; margin-top:24px; margin-bottom:8px; }
.guide-nav ol,.guide-nav ul { list-style:none; padding:0; margin:0; }
.guide-nav > ol > li { margin:0 0 16px; }
.guide-nav a { display:flex; gap:12px; padding:5px 0; text-decoration:none; color:var(--ui-text-muted); font-size:14px; line-height:1.4; transition:color var(--guide-motion) var(--guide-ease); overflow-wrap:anywhere; }
.guide-number { flex:0 0 22px; font-size:11px; font-variant-numeric:tabular-nums; padding-top:2px; }
.guide-nav ul { margin:8px 0 4px 34px; border-left:1px solid var(--ui-rule); padding-left:12px; }
.guide-nav ul a { font-size:12px; min-height:30px; }
.guide-nav .is-current > a { color:var(--ui-text); font-weight:600; }
.guide-nav a[aria-current="location"] { color:var(--ui-text); text-decoration:underline; text-underline-offset:5px; text-decoration-thickness:1px; }
.guide-nav a:hover { color:var(--ui-text); }
.guide-bottom { margin-top:auto; padding-top:40px; }
.guide-bottom form { margin-top:16px; }
.guide-download { display:flex; justify-content:space-between; padding:12px 0; border-top:1px solid var(--ui-rule); font-size:13px; }
.guide-document { min-width:0; animation:guide-enter 560ms var(--guide-ease) both; }
.guide-content { padding:0 clamp(24px,5vw,96px); max-width:1500px; margin:auto; }
.guide-content .brand-section { padding:80px 0; scroll-margin-top:24px; }
.guide-content [data-guide-anchor] { scroll-margin-top:24px; }
.guide-content .brand-section:first-of-type { padding-top:64px; }
.guide-chapter { font-size:11px; text-transform:uppercase; letter-spacing:.12em; color:var(--ui-text-muted); margin-bottom:20px; }
.guide-content .section-head h2 { font-size:clamp(32px,4vw,60px); letter-spacing:-.04em; line-height:1.12; }
.guide-subsection { border-top:1px solid var(--ui-rule); margin-top:48px; padding-top:32px; }
.guide-subsection h3 { font-size:24px; letter-spacing:-.02em; }
.guide-figure { display:block; max-width:100%; width:100%; height:auto; margin-top:24px; }
.guide-file { display:inline-block; margin-top:24px; }
.guide-resources { list-style:none; padding:0; margin-top:40px; }
.guide-resources li { display:flex; justify-content:space-between; gap:24px; padding:24px 0; border-top:1px solid var(--ui-rule); flex-wrap:wrap; }
.guide-document .portal-footer { padding:32px clamp(24px,5vw,96px); }
.guide-mobile,.guide-close { display:none; }
.structure-module { overflow-wrap:anywhere; }
.has-preview-bar .guide-rail { top:44px; height:calc(100dvh - 44px); }
.guide-content .colour-swatch,.guide-content .logo-canvas,.guide-content .icon-canvas { border-radius:0; }
.modal:not([hidden]) .modal-panel { animation:guide-enter 360ms var(--guide-ease) both; }
.copy,.option,.btn { transition-duration:240ms; transition-timing-function:var(--guide-ease); }
@keyframes guide-enter { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@media (min-width:761px) and (max-width:1099px) {
 .guideline-shell { grid-template-columns:220px minmax(0,1fr); }
 .guide-rail { padding:24px 20px; }
 .guide-content .logo-layout { grid-template-columns:1fr; }
}
@media (max-width:760px) {
 .guideline-shell { display:block; }
 .guide-mobile { display:flex; align-items:center; justify-content:space-between; gap:12px; position:sticky; top:0; z-index:25; background:var(--ui-bg); border-bottom:1px solid var(--ui-rule); min-height:64px; padding:12px 16px; font-size:13px; }
 .guide-mobile > span { min-width:0; overflow-wrap:anywhere; }
 .guide-mobile button { white-space:normal; max-width:60%; text-align:right; line-height:1.3; }
 [data-current-section] { display:block; font-size:11px; color:var(--ui-text-muted); }
 .guide-rail { position:static; width:100%; height:auto; border-right:0; border-bottom:1px solid var(--ui-rule); }
 .guide-enhanced .guide-rail { position:fixed; inset:0; height:100dvh; visibility:hidden; opacity:0; transform:translateX(-12px); pointer-events:none; transition:opacity var(--guide-motion) var(--guide-ease),transform var(--guide-motion) var(--guide-ease),visibility var(--guide-motion); }
 .guide-enhanced .guide-rail.is-open { visibility:visible; opacity:1; transform:none; pointer-events:auto; }
 .guide-enhanced .guide-close { display:block; margin-top:16px; }
 .guide-menu-open { overflow:hidden; }
 .guide-content { padding:0 20px; }
 .guide-content .brand-section { padding:56px 0; }
 .guide-content [data-guide-anchor] { scroll-margin-top:100px; }
 .guide-content .brand-section:first-of-type { padding-top:40px; }
 .guide-content .logo-layout { grid-template-columns:1fr; }
 .has-preview-bar .guide-mobile { top:44px; }
 .has-preview-bar .guide-rail { top:0; height:100dvh; }
}
@media print { .guideline-shell { display:block; } .guide-rail,.guide-mobile { display:none; } .guide-content { padding:0; } .guide-document { animation:none; } }

.guide-rail { overflow:hidden; }
.guide-identity,.guide-bottom { flex-shrink:0; }
.guide-nav { overflow:auto; min-height:0; flex:1 1 auto; scrollbar-width:thin; overscroll-behavior:contain; }
.guide-bottom { padding-top:24px; }

/* Editorial logo specimens. Colour changes are derived from the approved SVG. */
.logo-layout { display:block; }
.logo-canvas { width:100%; min-height:280px; }
.logo-detail { padding-top:24px; max-width:720px; }
.logo-variations { margin-top:48px; }
.logo-variant-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:40px 28px; margin-top:24px; }
.logo-variation { border-top:1px solid var(--ui-rule); padding-top:20px; min-width:0; }
.logo-variation h5 { font-size:16px; font-weight:500; margin-bottom:16px; }
.variant-specimen { height:220px; display:flex; align-items:center; justify-content:center; padding:32px; margin-bottom:16px; }
.variant-specimen img { width:100%; height:100%; object-fit:contain; }
.variant-specimen-light { background:#f4f3f0; }
.variant-specimen-dark { background:#20211f; }
.export-preview-dark { background:#20211f; }
.overview-prose { max-width:760px; font-size:clamp(17px,1.45vw,21px); line-height:1.7; }
@media(max-width:760px) { .logo-variant-grid {grid-template-columns:1fr;} .variant-specimen {height:190px;padding:24px;} .logo-canvas {min-height:180px;} }
.logo-canvas img { width:min(80%,640px); height:auto; max-height:240px; object-fit:contain; }
