/* Shared theme values also feed the living design-system view. */
:root {
  color-scheme: dark;
  --bg: #101114;
  --surface: #1b1e24;
  --surface-raised: #282d37;
  --ink: #f2f3f6;
  --muted: #b0b6c3;
  --line: #3e4552;
  --line-soft: #ffffff14;
  --blue: #a4b2ff;
  --accent-fill: #435fe8;
  --radius-card: 22px;
  --glass-bg: #232731b3;
  --glass-border: #ffffff24;
  --glass-shadow: 0 12px 38px #0005, 0 2px 6px #0003, inset 0 1px 0 #ffffff12;
}

body {
  background: radial-gradient(ellipse at 0 15%, #18203566, transparent 40%), var(--bg);
}
::selection { background: #4355a1; color: white; }
.monogram { background: var(--accent-fill); }
.tile { border: 1px solid var(--line-soft); border-radius: var(--radius-card); box-shadow: 0 1px 0 #0003; }
.operations-tile { background: linear-gradient(145deg, #20242c, var(--surface)); border-color: var(--line-soft); box-shadow: inset 0 1px 0 #ffffff06; }
.audio-clip { background: var(--surface-raised); border-color: #495162; box-shadow: 0 4px 12px #0002; }
.audio-clip i { background: #b1bbd1; }
.audio-clip[data-channel="1"] i { background: #a4b2ff; }
.audio-clip[data-channel="2"] i { background: #d3afa0; }
.stream[data-organized=true] .audio-clip { background: #2c3650; border-color: #6475a0; }
.stream[data-organized=true] .audio-clip i { background: #afbeff; }
.meta, .footer-meta, .section-bar h2 { color: var(--muted); }

.small-plus, .corner-plus, .close-dialog, .organize-control, .sketch-actions, .read-pill {
  color: var(--ink);
  background: linear-gradient(145deg, #ffffff12, #ffffff05);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 #ffffff10, 0 3px 12px #0001;
}
.small-plus:hover, .corner-plus:hover, .close-dialog:hover, .organize-control:hover, .read-pill:hover { background: #ffffff14; }
.button-plus { background: var(--surface-raised); }
.text-button:hover .button-plus { background: #3b4668; }
.contact-button { color: white; background: var(--accent-fill); border-color: #ffffff28; }
html[data-theme] .dialog-content .contact-button { color: white; }
.sketch-tile { background: #20263b; }
.sketch-copy .eyebrow, .sketch-copy p { color: #b2bddf; }
.palette button { border-color: #64708c; }
.palette button[aria-pressed=true] { outline-color: #b7c5f4; }
.pixel-grid { background: #b9c6ec73; border-color: #ffffff38; box-shadow: inset 0 1px 0 #ffffff38, 0 8px 20px #0002; }
.sketch-actions button { color: #c2ccef; }
.sketch-actions button:hover:not(:disabled) { color: white; }

.ami-tile { background: #222d2c; }
.ami-tile .tile-top, .ami-tile .tile-bottom > span { color: #b8cbc6; }
.work-grid > .batch-tile { background: #302923; }
.batch-tile .tile-top, .batch-tile .tile-bottom > span { color: #d0bfb2; }
.astrid-tile { background: #322630; }
.astrid-tile .tile-top, .astrid-tile .tile-bottom > span { color: #d6b7cb; }
.astrid-art > span { color: #e3bdd6; }
.astrid-art:before { border-color: #d9a6c13d; box-shadow: 0 0 0 24px #c49fb414, 0 0 0 48px #c49fb409; }
.unfurl-tile { background: linear-gradient(125deg, #28342d, #212a25); color: #e1eadc; border-color: var(--line-soft); }
.unfurl-tile .tile-top, .unfurl-copy p { color: #bbcdb7; }
.unfurl-status { background: #ffffff07; border-color: #ffffff24; }
.unfurl-art { color: #bbd1ae; }

.glass-dock { background: var(--glass-bg); border-color: var(--glass-border); box-shadow: var(--glass-shadow); }
.glass-dock:before { background: radial-gradient(ellipse at var(--gloss-x,25%) 0%, #ffffff14, transparent 60%), linear-gradient(180deg, #ffffff07, transparent 55%); }
.glass-dock .dock-item, .glass-dock .motion-control { color: var(--muted); }
.glass-dock .dock-item:hover, .glass-dock .motion-control:hover { color: var(--ink); background: #ffffff0c; }
.glass-dock .dock-home[aria-current=page] { color: var(--ink); background: linear-gradient(145deg, #ffffff15, #ffffff06); border-color: #ffffff24; box-shadow: inset 0 1px 0 #ffffff12, 0 2px 8px #0002; }
.glass-dock .motion-control[aria-pressed=true] { background: #ffffff12; }
.dock-divider { background: #ffffff1f; }

dialog { background: linear-gradient(140deg, #20242af5, #191c23f5); color: var(--ink); border-color: var(--glass-border); box-shadow: 0 35px 110px #0008, inset 0 1px 0 #ffffff0c; scrollbar-color: #566074 #1b1e24; }
dialog::backdrop { background: #07090eb3; }
.dialog-toolbar { background: linear-gradient(180deg, #262b34fa, #20242df5); color: var(--muted); border-color: var(--line-soft); box-shadow: inset 0 1px 0 #ffffff08; }
.dialog-content p, .case-facts p { color: var(--muted); }
.dialog-content .dialog-lead { color: #d1d6e1; }
.case-facts, .dialog-content .case-note { border-color: var(--line); }
.case-facts span, .citizen-gallery figcaption, .dialog-content .case-note { color: var(--muted); }
.citizen-detail-wordmark { filter: brightness(0) invert(1); }
.citizen-screens { border-color: var(--line-soft); box-shadow: inset 0 1px 0 #ffffff08, 0 10px 30px #0002; }
.case-flow { color: #c3cdff; background: #303e6c66; border-color: #9caeff26; box-shadow: inset 0 1px 0 #ffffff0a; }
.text-link, .dialog-content a { color: #c3ccff; }

/* Company-reported scale, distinct from Luis's individual contribution. */
.citizen-reach { margin: 34px 0 30px; padding: 25px 28px; border: 1px solid var(--line); border-radius: var(--radius-card); background: #ffffff03; }
.dialog-content .citizen-reach h3 {   margin: 0 0 22px; color: var(--muted); }
.citizen-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0; }
.citizen-stats > div { display: flex; flex-direction: column-reverse; gap: 6px; }
.citizen-stats dt {  color: var(--muted); }
.citizen-stats dd { margin: 0;     font-variant-numeric: lining-nums; }
.dialog-content .stats-source { margin: 24px 0 0; max-width: 690px; }
.stats-source a { text-decoration: underline; text-underline-offset: 3px; }

/* A compact entry to the portfolio's own materials. */
.system-tile { margin-top: 28px; background: var(--surface); }
.system-open { display: flex; align-items: center; justify-content: space-between; gap: 32px; width: 100%; min-height: 210px; padding: 32px; background: transparent; text-align: left; border-radius: inherit; }
.system-open:focus-visible { outline-offset: -5px; }
.system-copy .eyebrow { display: block; margin: 0 0 14px; }
.system-copy h3 { margin: 0 0 8px; }
.system-copy p { color: var(--muted); margin: 0; }
.system-art { display: flex; align-items: center; gap: 36px; margin-left: auto; padding-right: 45px; }
.system-colors { display: flex; padding-left: 12px; }
.system-colors i { display: block; width: 38px; height: 38px; border-radius: 50%; margin-left: -12px; background: var(--blue); border: 2px solid var(--surface); transition: transform .4s var(--ease); }
.system-colors i:nth-child(2) { background: var(--ink); }
.system-colors i:nth-child(3) { background: var(--surface-raised); }
.system-plus { flex: 0 0 auto; width: 40px; height: 40px; }
@media (hover:hover) and (pointer:fine) {
  html[data-motion=on] .system-open:hover .system-colors i:first-child { transform: translateX(-6px); }
  html[data-motion=on] .system-open:hover .system-colors i:last-child { transform: translateX(6px); }
}
.system-open:focus-visible .system-plus { border-color: var(--blue); }

/* Specimens use the same theme values, fonts and button styles as the page. */
.ds-section { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.dialog-content .ds-section h3 {   margin: 0 0 20px; }
.ds-colors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 0; }
.ds-swatch { display: block; width: 100%; height: 64px; margin-bottom: 10px; border: 1px solid #ffffff26; border-radius: 12px; }
.ds-colors dd { margin: 4px 0 0;  color: var(--muted); font-variant-numeric: tabular-nums; }

.ds-label {  color: var(--muted); }


.ds-component { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 24px; background: var(--surface-raised); border: 1px solid var(--line-soft); border-radius: var(--radius-card); }
.dialog-content .ds-component p {   margin: 7px 0 0; }
.ds-theme-button { position: static; margin: 0; flex: 0 0 auto; min-height: 44px; padding: 10px 18px; border-radius: 999px; }
.dialog-content .ds-description { max-width: 740px;   margin: -5px 0 22px; }
.ds-color-use { display: block; margin-top: 7px; }

.ds-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; }
.ds-metrics dt { color: var(--muted); }
.ds-metrics dd { color: var(--ink);   margin: 7px 0 0; }
.ds-behaviors { display: grid; gap: 20px; margin: 0; }
.ds-behaviors > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 24px; }
.ds-behaviors dd { margin: 0; max-width: 640px; color: var(--muted); }

.dialog-content .ds-type-key {   color: var(--muted); margin: -5px 0 18px; }





.ds-type-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 24px; padding: 22px 0; border-top: 1px solid var(--line-soft); }
.ds-type-info { display: flex; flex-direction: column; gap: 4px; }
.ds-type-family, .ds-type-metrics {  color: var(--muted); }
.ds-type-metrics { font-variant-numeric: tabular-nums; }
.ds-type-sample { display: block; min-width: 0; overflow-wrap: break-word; color: var(--ink); }
@media (max-width:570px) {
  .ds-behaviors > div { grid-template-columns: 1fr; gap: 6px; }
  .ds-metrics { gap: 12px; }
  
  .ds-type-row { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width:760px) {
  :root { --radius-card: 17px; }
  .citizen-reach { padding: 22px 20px; }
  .citizen-stats { gap: 16px; }
  .system-tile { margin-top: 24px; }
  .system-open { padding: 25px; min-height: 185px; gap: 20px; }
  .system-art { padding-right: 0; gap: 20px; }
  .system-colors i { width: 28px; height: 28px; }
}
@media (max-width:570px) {
  .citizen-stats { grid-template-columns: 1fr; gap: 23px; }
  .citizen-stats > div { padding-bottom: 19px; border-bottom: 1px solid var(--line-soft); }
  .citizen-stats > div:last-child { padding-bottom: 0; border-bottom: 0; }
  .system-open { flex-wrap: wrap; position: relative; }
  .system-copy { width: 100%; padding-right: 35px; }
  .system-art { margin-left: 0; gap: 30px; }
  .system-plus { position: absolute; top: 22px; right: 22px; }
  .ds-colors { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; }
  
  .ds-component { align-items: flex-start; flex-direction: column; padding: 20px; }
}
@media (prefers-reduced-transparency:reduce) {
  .glass-dock, dialog, .dialog-toolbar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .small-plus, .corner-plus, .close-dialog, .organize-control, .sketch-actions, .read-pill { background: var(--surface-raised); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
  .glass-dock, dialog, .dialog-toolbar { background: var(--surface); }
}
@media (prefers-contrast:more) {
  .glass-dock, dialog, .dialog-toolbar { background: #101114; border-color: #9aa6bd; }
  .dock-item, .dialog-content p, .case-facts p { color: var(--ink); }
  .tile { border-color: #778298; }
}

/* Compare the light palette without changing layout or project content. */
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-raised: #edf0f6;
  --ink: #23252b;
  --muted: #5e6572;
  --line: #d6dae4;
  --line-soft: #1e253412;
  --blue: #435fe8;
  --glass-bg: #ffffffa6;
  --glass-border: #ffffffc7;
  --glass-shadow: 0 12px 38px #19203d1a, 0 2px 6px #19203d0a, inset 0 1px 1px #fffffff2;
}
html[data-theme=light] body { background: radial-gradient(ellipse at 6% 24%, #e3e9fc6b, transparent 38%), radial-gradient(ellipse at 100% 70%, #f1e5eb66, transparent 37%), var(--bg); }
html[data-theme=light] ::selection { background: #d9dfff; color: #1b2d86; }
html[data-theme=light] .operations-tile { background: linear-gradient(145deg, #ffffffeb, #ffffff9e); box-shadow: inset 0 1px 1px white; }
html[data-theme=light] .audio-clip { background: white; border-color: #dce1ec; box-shadow: 0 3px 8px #323e650c; }
html[data-theme=light] .audio-clip i { background: #9ba6c0; }
html[data-theme=light] .audio-clip[data-channel="1"] i { background: #8398f0; }
html[data-theme=light] .audio-clip[data-channel="2"] i { background: #bd9d8e; }
html[data-theme=light] .stream[data-organized=true] .audio-clip { background: #f0f3ff; border-color: #d4ddf5; }
html[data-theme=light] .stream[data-organized=true] .audio-clip i { background: #738add; }
html[data-theme=light] :is(.small-plus, .close-dialog, .organize-control, .sketch-actions, .read-pill) { background: linear-gradient(145deg, #ffffffd9, #f3f5fb99); border-color: #cbd2df84; box-shadow: inset 0 1px 1px white, 0 3px 12px #2937540d; }
html[data-theme=light] :is(.small-plus, .close-dialog, .organize-control, .read-pill):hover { background: #ffffffc7; }
html[data-theme=light] .text-button:hover .button-plus { background: #dfe5ff; }
html[data-theme=light] .citizen-tile :is(.corner-plus, .read-pill) { color: #e5eaf4; background: linear-gradient(145deg, #ffffff26, #ffffff0a); border-color: #ffffff47; box-shadow: inset 0 1px 1px #ffffff38, 0 4px 14px #0000000d; }
html[data-theme=light] .citizen-tile :is(.corner-plus, .read-pill):hover { background: #ffffff2b; }
html[data-theme=light] .sketch-tile { background: #e9edff; }
html[data-theme=light] .sketch-copy :is(.eyebrow, p) { color: #647093; }
html[data-theme=light] .palette button { border-color: #d7def3; }
html[data-theme=light] .palette button[aria-pressed=true] { outline-color: #7b8cb5; }
html[data-theme=light] .pixel-grid { background: #ffffff66; border-color: #ffffffa6; box-shadow: inset 0 1px 1px white, 0 8px 20px #5670bd14; }
html[data-theme=light] .sketch-actions button { color: #52638f; }
html[data-theme=light] .sketch-actions button:hover:not(:disabled) { color: #192c6d; }
html[data-theme=light] .ami-tile { background: #e9ece9; }
html[data-theme=light] .ami-tile :is(.tile-top, .tile-bottom > span) { color: #56685f; }
html[data-theme=light] .work-grid > .batch-tile { background: #e8e3de; }
html[data-theme=light] .batch-tile :is(.tile-top, .tile-bottom > span) { color: #756152; }
html[data-theme=light] .astrid-tile { background: #ead8df; }
html[data-theme=light] .astrid-tile :is(.tile-top, .tile-bottom > span) { color: #785268; }
html[data-theme=light] .astrid-art > span { color: #815b70; }
html[data-theme=light] .astrid-art:before { border-color: #ac80963b; box-shadow: 0 0 0 24px #c49fb41a, 0 0 0 48px #c49fb40a; }
html[data-theme=light] .unfurl-tile { background: linear-gradient(125deg, #e9ece5, #e0e5de); color: #46564a; }
html[data-theme=light] .unfurl-tile .tile-top, html[data-theme=light] .unfurl-copy p { color: #526352; }
html[data-theme=light] .unfurl-status { background: #ffffff45; border-color: #ffffff75; }
html[data-theme=light] .unfurl-art { color: #586f59; }
html[data-theme=light] .glass-dock:before { background: radial-gradient(ellipse at var(--gloss-x,25%) 0%, #ffffffba, transparent 60%), linear-gradient(180deg, #ffffff35, transparent 55%, #ffffff18); }
html[data-theme=light] .glass-dock :is(.dock-item, .motion-control):hover { background: #ffffff70; }
html[data-theme=light] .glass-dock .dock-home[aria-current=page] { background: linear-gradient(145deg, #ffffffdb, #ffffff73); border-color: #ffffff9e; box-shadow: inset 0 1px 1px white, 0 2px 8px #29396d12; }
html[data-theme=light] .glass-dock .motion-control[aria-pressed=true] { background: #ffffff5c; }
html[data-theme=light] .dock-divider { background: #929cb933; }
html[data-theme=light] dialog { background: linear-gradient(140deg, #fffffff0, #f5f7fde8); box-shadow: 0 35px 110px #0b163b38, inset 0 1px 1px white; scrollbar-color: #9ba6bc #edf0f6; }
html[data-theme=light] dialog::backdrop { background: #1b243b3b; }
html[data-theme=light] .dialog-toolbar { background: linear-gradient(180deg, #fcfdfff5, #f8faffed); box-shadow: inset 0 1px 1px white; }
html[data-theme=light] .dialog-content .dialog-lead { color: #505c70; }
html[data-theme=light] .citizen-detail-wordmark { filter: brightness(0); }
html[data-theme=light] .citizen-reach { background: #ffffff60; }
html[data-theme=light] .citizen-screens { border-color: #ffffff24; box-shadow: 0 10px 30px #17243b12, inset 0 1px 1px #ffffff30; }
html[data-theme=light] .case-flow { color: #52649f; background: #dfe7ff66; border-color: #ffffffb3; box-shadow: inset 0 1px 1px white; }
html[data-theme=light] .text-link, html[data-theme=light] .dialog-content a { color: var(--blue); }
html[data-theme=light] .ds-swatch { border-color: #23252b26; }

/* The same control stays available inside the native modal's top layer. */
.theme-toggle { position: fixed; top: calc(24px + env(safe-area-inset-top, 0px)); right: calc(24px + env(safe-area-inset-right, 0px)); z-index: 60; display: grid; place-items: center; width: 46px; height: 46px; padding: 12px; color: var(--ink); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 50%; box-shadow: var(--glass-shadow); backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5); transition: transform .2s var(--ease), background .2s; touch-action: manipulation; }
.theme-toggle:hover { background: var(--surface-raised); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { grid-area: 1 / 1; width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-moon { display: none; }
html[data-theme=light] .theme-toggle .theme-moon { display: block; }
html[data-theme=light] .theme-toggle .theme-sun { display: none; }
.dialog-actions { display: flex; gap: 10px; align-items: center; }
.dialog-theme-toggle { position: static; width: 44px; height: 44px; box-shadow: inset 0 1px 0 #ffffff0c; }
@media (max-width:760px) {
  .theme-toggle:not(.dialog-theme-toggle) { top: calc(18px + env(safe-area-inset-top, 0px)); right: calc(18px + env(safe-area-inset-right, 0px)); width: 44px; height: 44px; }
}
@media (prefers-reduced-transparency:reduce) {
  .theme-toggle { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  html[data-theme=light] :is(.glass-dock, dialog, .dialog-toolbar) { background: var(--surface); }
  html[data-theme=light] :is(.small-plus, .close-dialog, .organize-control, .sketch-actions, .read-pill) { background: var(--surface-raised); }
}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))) {
  .theme-toggle, html[data-theme=light] :is(.glass-dock, dialog, .dialog-toolbar) { background: var(--surface); }
}
@media (prefers-contrast:more) {
  .theme-toggle { background: var(--surface); border-color: var(--muted); }
  html[data-theme=light] :is(.glass-dock, dialog, .dialog-toolbar) { background: #ffffff; border-color: #566078; }
}
