:root {
  color-scheme: light;
  --night: #061c38;
  --midnight: #0a294f;
  --blue: #155f9c;
  --blue-bright: #267fbc;
  --mist: #dcecf6;
  --mist-2: #edf6fb;
  --ground: #f5f8fa;
  --paper: #ffffff;
  --ink: #10253a;
  --muted: #566c7e;
  --line: #c7dbe8;
  --focus: #f1b748;
  --danger: #a12d37;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  transform: translateY(-180%);
  padding: .65rem 1rem;
  border-radius: .35rem;
  background: var(--paper);
}
.skip-link:focus { transform: none; }

.site-header {
  min-height: 72px;
  padding: 0 max(1.25rem, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--night);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.16);
}
.brand { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; font-family: var(--serif); font-weight: 700; }
.brand img { filter: brightness(0) invert(1); }
.product-name { color: #bcd9ea; font-size: .9rem; letter-spacing: .02em; }

main {
  min-height: 72vh;
  background:
    radial-gradient(circle at 88% 3%, rgba(65, 150, 206, .17), transparent 28rem),
    linear-gradient(180deg, #edf5fa 0, var(--ground) 34rem);
}
.noscript { margin: 0; padding: 2rem; text-align: center; }
.explorer-shell { width: min(1180px, calc(100% - 2.5rem)); margin: 0 auto; padding: 4.5rem 0 6rem; }
.explorer-shell--entry { padding-top: 5.5rem; }

h1, h2, .pattern-card__name { font-family: var(--serif); color: var(--night); }
h1 { margin: .2rem 0 1.25rem; font-size: clamp(2.5rem, 6vw, 5.1rem); line-height: 1.01; letter-spacing: -.035em; font-weight: 500; }
h2 { margin: .35rem 0 .8rem; font-size: clamp(1.55rem, 3vw, 2.35rem); line-height: 1.2; font-weight: 500; }
p { margin: 0 0 1rem; }
.eyebrow { color: var(--blue); font-size: .75rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.lede { max-width: 45rem; color: #385368; font-size: clamp(1.05rem, 1.8vw, 1.3rem); line-height: 1.65; }
.narrow-heading { max-width: 810px; margin-bottom: 3.5rem; }
.narrow-heading--results { margin-bottom: 3rem; }
.narrow-heading--results h1, .gallery-heading h1 { font-size: clamp(2.5rem, 5vw, 4.25rem); }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: clamp(2.5rem, 7vw, 7rem); align-items: center; }
.entry-card {
  position: relative;
  padding: 2rem;
  border: 1px solid #b8d4e5;
  border-radius: 1rem;
  background: rgba(255,255,255,.94);
  box-shadow: 0 24px 70px rgba(10, 41, 79, .13);
}
.entry-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; border-radius: 1rem 0 0 1rem; background: linear-gradient(var(--blue-bright), var(--midnight)); }
.entry-card label { display: block; color: var(--night); font-weight: 750; font-size: 1.03rem; }
.field-hint { margin: .25rem 0 .9rem; color: var(--muted); font-size: .9rem; }
input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #9fbdcf;
  border-radius: .5rem;
  background: #fff;
  color: var(--ink);
}
input { padding: .75rem .9rem; }
#profile-code { text-transform: uppercase; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(161,45,55,.12); }
.field-error { min-height: 1.55rem; margin: .5rem 0; color: var(--danger); font-size: .88rem; }

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .72rem 1.2rem;
  border: 1px solid transparent;
  border-radius: .48rem;
  cursor: pointer;
  font-weight: 720;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button--primary { background: var(--midnight); color: #fff; box-shadow: 0 8px 20px rgba(10,41,79,.17); }
.button--primary:hover { background: var(--blue); }
.button--secondary { border-color: #92b5cc; background: transparent; color: var(--midnight); }
.button--secondary:hover { background: var(--mist-2); }
.button:disabled { opacity: .4; cursor: default; }
.button--wide { width: 100%; }
.button-row { display: flex; gap: .85rem; flex-wrap: wrap; }
.text-button, .back-link, .next-link {
  border: 0;
  padding: .5rem 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.text-button { width: 100%; margin-top: .7rem; }
.quiet-link { display: block; margin-top: .15rem; text-align: center; font-size: .88rem; }
.privacy-note { max-width: 720px; display: flex; gap: .8rem; align-items: flex-start; margin-top: 4.5rem; padding: 1.1rem 1.25rem; border: 1px solid #bdd8e8; border-radius: .75rem; background: rgba(221,238,247,.68); color: #25475f; }
.privacy-icon { width: 1.6rem; height: 1.6rem; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--midnight); color: #fff; font-size: .76rem; }
.boundary-note { max-width: 720px; margin-top: 1rem; color: var(--muted); font-size: .86rem; }

.scores-form { display: grid; gap: 2.5rem; }
fieldset { margin: 0; padding: 1.5rem; border: 1px solid var(--line); border-radius: .85rem; background: rgba(255,255,255,.85); }
legend { padding: 0 .55rem; color: var(--night); font-family: var(--serif); font-size: 1.45rem; }
.score-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 1rem; }
.score-field span { display: block; min-height: 2.8rem; margin-bottom: .35rem; color: #365266; font-size: .88rem; line-height: 1.3; }
.score-field select { padding: .55rem .65rem; }
.confirmation-panel { max-width: 760px; margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem); border: 1px solid #b8d4e5; border-radius: 1rem; background: #fff; box-shadow: 0 24px 70px rgba(10,41,79,.12); text-align: center; }
.confirmation-panel h1 { font-size: clamp(2.3rem, 5vw, 4rem); }
.confirmation-panel .lede { margin-inline: auto; }
.code-output { display: block; margin: 2rem 0 1rem; padding: 1rem; border-radius: .55rem; background: var(--mist-2); color: var(--night); font-size: clamp(1.15rem, 4vw, 1.8rem); font-weight: 760; letter-spacing: .09em; overflow-wrap: anywhere; user-select: all; }
.copy-status { min-height: 1.7rem; color: var(--muted); }
.confirmation-panel .button-row { justify-content: center; }

.results-toolbar { display: flex; justify-content: flex-end; }
.pattern-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.pattern-grid--gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pattern-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid #b9d2e1;
  border-radius: .9rem;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 9px 26px rgba(10,41,79,.07);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.pattern-card:hover { transform: translateY(-3px); border-color: #6ba3c5; box-shadow: 0 18px 38px rgba(10,41,79,.13); }
.pattern-art { overflow: hidden; background: radial-gradient(circle at 50% 40%, #1b5f91, #0b315a 48%, #061c38); }
.pattern-art svg { display: block; width: 100%; height: auto; }
.pattern-art--card svg { aspect-ratio: 620 / 286; }
.pattern-art--detail { border-radius: 1rem; box-shadow: 0 22px 58px rgba(4,27,54,.19); }
.registered-artwork { aspect-ratio: 3 / 2; }
.registered-artwork img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mark-ground { stroke: rgba(202,229,244,.34); stroke-width: 1; }
.mark-stratum { fill: none; stroke: rgba(172,211,235,.22); stroke-width: 3; stroke-linecap: round; }
.mark-divider { stroke: rgba(210,233,246,.55); stroke-width: 1.5; stroke-dasharray: 4 7; }
.mark-shadow { fill: rgba(0,0,0,.28); }
.mark-disc { fill: #e8f3f9; stroke: rgba(255,255,255,.88); stroke-width: 1.5; }
.mark-node--counterbalances .mark-disc { fill: #b9d2e2; stroke-dasharray: 4 3; }
.pattern-card__body { min-height: 190px; display: flex; flex-direction: column; padding: 1.45rem; }
.pattern-card__name { display: block; font-size: clamp(1.3rem, 2.5vw, 1.75rem); line-height: 1.2; }
.pattern-card__line { display: block; margin-top: .7rem; color: #496275; line-height: 1.5; }
.pattern-card__cue { display: block; margin-top: auto; padding-top: 1rem; color: var(--blue); font-size: .86rem; font-weight: 720; }
.reflection-panel, .next-step-panel { margin-top: 3.5rem; padding: clamp(1.6rem, 4vw, 3.2rem); border-radius: 1rem; background: linear-gradient(135deg, #e1f0f8, #f6fbfd); border: 1px solid #bdd8e7; }
.reflection-panel h2, .next-step-panel h2 { max-width: 750px; }
.reflection-panel p:not(.eyebrow), .next-step-panel p:not(.eyebrow) { max-width: 680px; color: #3f596d; }
.learn-link { display: inline-block; margin-left: 1rem; }
.practitioner-note { margin-top: 1.2rem; font-size: .9rem; }

.detail-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.detail-article { max-width: 980px; margin: 0 auto; }
.detail-heading { max-width: 820px; margin: 0 auto 2.5rem; text-align: center; }
.detail-heading h1 { font-size: clamp(2.7rem, 6vw, 5rem); }
.structural-name { color: var(--muted); font-size: 1.08rem; }
.detail-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; margin: 3.3rem 0; font-size: 1.08rem; }
blockquote { margin: 0; padding: 1.2rem 0 1.2rem 1.4rem; border-left: 4px solid var(--blue-bright); color: var(--midnight); font-family: var(--serif); font-size: 1.5rem; line-height: 1.45; }
.detail-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.detail-section { padding: 1.4rem; border-top: 1px solid #aac9db; background: rgba(255,255,255,.48); }
.detail-section h2 { font-size: 1.35rem; }
.detail-section ul { margin: .5rem 0 0; padding-left: 1.2rem; color: #415b6d; }
.reflection-question { margin-top: 3.5rem; padding: 2.2rem; border-radius: 1rem; background: var(--midnight); }
.reflection-question h2, .reflection-question .eyebrow { color: #fff; }

.gallery-heading { margin: 2rem 0 3rem; }
.search-field { display: block; max-width: 540px; margin-top: 2rem; }
.search-field span { display: block; margin-bottom: .4rem; color: var(--night); font-weight: 720; }
.results-count { margin-top: .8rem; color: var(--muted); font-size: .9rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 3rem; }
.empty-state { padding: 3rem; border: 1px dashed #97b8cc; border-radius: .75rem; text-align: center; color: var(--muted); }

/* The shared footer ships its own inline styles. Keep its small text readable
   on this accessibility-first surface without changing the site-wide source. */
.footer .footer-col-title,
.footer .footer-brand-tagline,
.footer .footer-bottom,
.footer .footer-trademark { color: #5b5148; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { max-width: 760px; }
  .entry-card { max-width: 620px; }
  .score-grid { grid-template-columns: repeat(3, minmax(110px, 1fr)); }
  .pattern-grid--gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-header { min-height: 64px; padding: 0 1rem; }
  .brand span { display: none; }
  .explorer-shell { width: min(100% - 1.5rem, 1180px); padding: 3rem 0 4.5rem; }
  .explorer-shell--entry { padding-top: 3.5rem; }
  h1 { font-size: clamp(2.35rem, 12vw, 3.5rem); }
  .entry-card { padding: 1.35rem; }
  .privacy-note { margin-top: 2.5rem; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  fieldset { padding: 1rem; }
  .pattern-grid, .pattern-grid--gallery { grid-template-columns: 1fr; }
  .pattern-card__body { min-height: 170px; }
  .learn-link { display: block; margin: 1rem 0 0; }
  .detail-intro, .detail-columns { grid-template-columns: 1fr; gap: 1.2rem; }
  .detail-nav { align-items: flex-start; }
  .button-row .button { width: 100%; }
  .pagination { flex-wrap: wrap; }
}

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