/* Pip-Boy style portfolio. Colors are tokens; "plain" swaps the CRT effects for a clean reading view. */
:root {
    --bg: #071205;
    --screen: #0b1f08;
    --fg: #41ff6e;
    --fg-strong: #9dffb4;
    --dim: #2a9c47;
    --line: #1f7a37;
    --warn: #ffb641;
    --glow: 0 0 6px rgba(65, 255, 110, .45);
    --mono: "VT323", ui-monospace, monospace;
    --sans: "Chakra Petch", system-ui, sans-serif;
    font-family: var(--sans);
    font-size: clamp(15px, 0.45vw + 12.5px, 18px);
    line-height: 1.55;
    color-scheme: dark;
    scrollbar-color: var(--dim) transparent;
}

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

html, body { height: 100%; }

body {
    background: radial-gradient(ellipse at center, #0f2a0b 0%, var(--bg) 75%);
    color: var(--fg);
    display: grid;
    place-items: center;
    cursor: url('./cursor.png'), auto;
    overflow: hidden;
}

a { color: inherit; cursor: url('./cursor.png'), pointer; }

/* ---------- the screen ---------- */
.screen {
    position: relative;
    width: min(1180px, calc(100vw - 32px));
    height: calc(100dvh - 32px);
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    grid-template-columns: minmax(0, 1fr);
    border: 2px solid var(--line);
    border-radius: 18px;
    background:
        radial-gradient(ellipse at center, rgba(65, 255, 110, .07), transparent 70%),
        var(--screen);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, .65), 0 0 40px rgba(65, 255, 110, .12);
    text-shadow: var(--glow);
    overflow: hidden;
    isolation: isolate;
}

/* scanlines + slow roll bar, drawn over content without hurting text contrast */
.screen::before, .screen::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}
.screen::before {
    background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
}
.screen::after {
    background: linear-gradient(to bottom, transparent 0%, rgba(65, 255, 110, .06) 50%, transparent 100%);
    height: 25%;
    animation: roll 9s linear infinite;
}
@keyframes roll { from { transform: translateY(-100%); } to { transform: translateY(400%); } }

/* ---------- header ---------- */
.top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem 1.5rem;
    padding: 18px 1.5rem .6rem;
}
h1 {
    font-family: var(--mono);
    font-weight: 400;
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    line-height: 1;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--fg-strong);
}
.role {
    font-family: var(--mono);
    font-size: 1.35rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--dim);
}
.status { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-left: auto; margin-top: 4px; }
.pill, .viewswitch {
    font-family: var(--mono);
    font-size: 1.15rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    padding: .15rem .65rem;
    border-radius: 999px;
    background: transparent;
    color: var(--fg);
    text-shadow: inherit;
}
.pill-live { border-color: var(--warn); color: var(--warn); }
.dot {
    display: inline-block;
    width: .5rem; height: .5rem;
    margin-right: .45rem;
    border-radius: 50%;
    background: var(--warn);
    box-shadow: 0 0 8px var(--warn);
    animation: pulse 1.6s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes pulse { 50% { opacity: .3; } }
.viewswitch {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    padding: 2px;
    cursor: url('./cursor.png'), pointer;
}
.viewswitch .opt { position: relative; z-index: 1; padding: 0 .45rem; text-align: center; transition: color .25s; }
.viewswitch .thumb {
    position: absolute;
    top: 2px; bottom: 2px; left: 2px;
    width: calc(50% - 2px);
    border-radius: 999px;
    background: var(--fg);
    transform: translateX(var(--x, 0%));
    transition: transform .3s cubic-bezier(.3, 1.5, .5, 1);
}
.viewswitch[aria-checked="true"] { --x: 100%; }
.viewswitch[aria-checked="false"] .opt:nth-child(2),
.viewswitch[aria-checked="true"] .opt:nth-child(3) { color: var(--screen); text-shadow: none; }
.viewswitch:hover { border-color: var(--fg); }

/* ---------- Pip-Boy tabs ---------- */
.tabs { padding: 0 1.5rem; border-bottom: 2px solid var(--line); }
[role="tablist"] {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    scrollbar-width: none;
}
[role="tab"] {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .35rem 1rem .3rem;
    text-decoration: none;
    border: 2px solid transparent;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    margin-bottom: -2px;
    color: var(--dim);
    font-size: .8rem;
    letter-spacing: .04em;
}
[role="tab"] .k {
    font-family: var(--mono);
    font-size: 1.6rem;
    line-height: 1;
    letter-spacing: .08em;
}
[role="tab"]:hover { color: var(--fg); }
[role="tab"][aria-selected="true"] {
    color: var(--fg-strong);
    border-color: var(--line);
    background: var(--screen);
}

/* ---------- panels ---------- */
main { min-height: 0; position: relative; }
[role="tabpanel"] {
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    animation: flicker .35s ease-out;
}
[role="tabpanel"][hidden] { display: none; }
@keyframes flicker { 0% { opacity: 0; } 30% { opacity: .7; } 45% { opacity: .3; } 100% { opacity: 1; } }

h2 {
    font-family: var(--mono);
    font-weight: 400;
    font-size: 2rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--fg-strong);
    margin-bottom: 1rem;
}
h3 { font-weight: 600; font-size: 1.1rem; color: var(--fg-strong); }
h4 {
    font-family: var(--mono);
    font-weight: 400;
    font-size: 1.3rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dim);
    margin: 1.1rem 0 .35rem;
}
p + p { margin-top: .75rem; }
b { font-weight: 600; color: var(--fg-strong); }
code {
    font-family: var(--mono);
    font-size: 1.15em;
    padding: 0 .25em;
    border: 1px solid var(--line);
    border-radius: 4px;
}
.muted { color: var(--dim); font-weight: 400; }
.note { color: var(--dim); margin-top: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 10; background: var(--fg); color: var(--screen); padding: .4rem .8rem; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px dashed var(--fg-strong); outline-offset: 3px; }

ul:not(.chips):not(.stations) { list-style: none; }
ul:not(.chips):not(.stations) > li { position: relative; padding-left: 1.2rem; margin: .3rem 0; }
ul:not(.chips):not(.stations) > li::before { content: "+"; position: absolute; left: 0; color: var(--dim); }

/* ---------- STAT ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: minmax(180px, 280px) 1fr;
    gap: 2rem;
    align-items: start;
    max-width: 1000px;
}
.portrait img {
    display: block;
    width: 100%;
    height: auto;
    border: 2px solid var(--line);
    border-radius: 12px;
    filter: grayscale(1) sepia(1) hue-rotate(65deg) saturate(2.4) brightness(.9) contrast(1.05);
    transition: filter .5s;
}
.portrait img:hover { filter: none; }
.bio { font-size: 1.12rem; max-width: 62ch; }
.bio a { color: var(--fg-strong); }
.bio.typing::after {
    content: "";
    display: inline-block;
    width: .55em; height: 1.05em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: var(--fg);
    animation: pulse .7s step-end infinite;
}
.facts { margin-top: 1.4rem; border-top: 1px solid var(--line); max-width: 62ch; }
.facts div {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 1rem;
    padding: .4rem 0;
    border-bottom: 1px solid var(--line);
}
.facts dt { font-family: var(--mono); font-size: 1.2rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.cta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.btn {
    font-family: var(--mono);
    font-size: 1.3rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
    padding: .2rem 1rem;
    border: 2px solid var(--fg);
    background: var(--fg);
    color: var(--screen);
    text-shadow: none;
}
.btn-ghost { background: transparent; color: var(--fg); text-shadow: inherit; }
.btn:hover { background: var(--fg-strong); border-color: var(--fg-strong); color: var(--screen); text-shadow: none; }

/* ---------- DATA / QUESTS ---------- */
.job, .quest {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    max-width: 980px;
}
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1.5rem; }
.org { color: var(--dim); }
.when { font-family: var(--mono); font-size: 1.2rem; letter-spacing: .04em; white-space: nowrap; }
.featured { border-color: var(--fg); box-shadow: inset 0 0 30px rgba(65, 255, 110, .06); }
.quest-head { margin-bottom: .6rem; }
.tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 1.05rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--warn);
    border: 1px solid var(--warn);
    padding: 0 .45rem;
    margin-bottom: .35rem;
}
.links { display: flex; gap: 1rem; margin-top: .25rem; }
.links a { font-family: var(--mono); font-size: 1.2rem; letter-spacing: .06em; text-transform: uppercase; }
.links a::after { content: " ↗"; }
.term {
    font-family: var(--mono);
    font-size: 1.1rem;
    line-height: 1.3;
    white-space: pre-wrap;
    background: rgba(0, 0, 0, .35);
    border-left: 3px solid var(--fg);
    padding: .75rem 1rem;
    margin: 1rem 0 .25rem;
    overflow-x: auto;
}
.term .c { color: var(--dim); }
.steps { padding-left: 1.4rem; }
.steps li { margin: .3rem 0; padding-left: .2rem; }
.steps li::marker { font-family: var(--mono); color: var(--dim); }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.chips li {
    font-size: .85rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: .1rem .5rem;
}
.chips-dim li { color: var(--dim); border-style: dashed; }

/* ---------- INV ---------- */
.inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    max-width: 1100px;
}
.inv { border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem 1rem; }
.inv .chips { margin-top: .5rem; }

/* ---------- RADIO ---------- */
.lead { font-size: 1.12rem; max-width: 60ch; margin-bottom: 1.2rem; }
.stations { list-style: none; max-width: 640px; border-top: 1px solid var(--line); }
.stations a {
    display: grid;
    grid-template-columns: 5rem 7rem 1fr;
    align-items: baseline;
    gap: 1rem;
    padding: .6rem .5rem;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}
.stations a:hover { background: var(--fg); color: var(--screen); text-shadow: none; }
.stations a:hover .muted { color: var(--screen); }
.freq { font-family: var(--mono); font-size: 1.4rem; }
.stations .muted { overflow-wrap: anywhere; }

/* ---------- footer ---------- */
.bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .4rem 1rem;
    padding: .5rem 1.5rem;
    border-top: 2px solid var(--line);
    font-family: var(--mono);
    font-size: 1.15rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--dim);
}
.foot-links { display: flex; gap: 1.2rem; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--fg-strong); }

/* ---------- plain view: same layout, no CRT ---------- */
.plain {
    --bg: #f6f7f4;
    --screen: #ffffff;
    --fg: #1d2b1f;
    --fg-strong: #0b130c;
    --dim: #4f6352;
    --line: #cfd8d0;
    --warn: #a35a00;
    --glow: none;
    color-scheme: light;
}
.plain body { background: var(--bg); cursor: auto; }
.plain a, .plain .viewswitch { cursor: pointer; }
.plain .screen { background: var(--screen); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); text-shadow: none; }
.plain .screen::before, .plain .screen::after { display: none; }
.plain .portrait img { filter: none; }
.plain .dot { box-shadow: none; }
.plain .featured { box-shadow: none; }
.plain .term { background: #f1f4f1; }
.plain [role="tabpanel"] { animation: none; }
.plain .btn { color: #fff; }
.plain .btn-ghost { color: var(--fg); }
.plain .btn:hover, .plain .btn-ghost:hover { color: #fff; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
    body { place-items: stretch; }
    .screen { width: 100vw; height: 100dvh; border-radius: 0; border-width: 0; }
    .top { padding: 14px 1rem .5rem; gap: .5rem; }
    h1 { font-size: 2rem; }
    .role { font-size: 1.05rem; }
    .pill, .viewswitch { font-size: 1rem; }
    .status { margin-left: 0; }
    .tabs { padding: 0 .5rem; }
    [role="tab"] { padding: .3rem .65rem .25rem; font-size: .72rem; }
    [role="tab"] .k { font-size: 1.35rem; }
    [role="tabpanel"] { padding: 1rem; }
    .stat-grid { grid-template-columns: 1fr; gap: 1.2rem; }
    .portrait { max-width: 150px; }
    .facts div { grid-template-columns: 6.5rem 1fr; gap: .6rem; }
    .stations a { grid-template-columns: 4rem 1fr; gap: 0 .75rem; }
    .stations a .muted { grid-column: 2; }
    .bottom { padding: .4rem 1rem; font-size: 1rem; }
    .bottom > span:first-child { display: none; }
}

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

/* ---------- print: everything, black on white ---------- */
@media print {
    :root { --fg: #000; --fg-strong: #000; --dim: #444; --line: #bbb; --warn: #000; --screen: #fff; --glow: none; font-size: 11pt; }
    body { display: block; overflow: visible; background: #fff; }
    .screen { display: block; width: auto; height: auto; border: 0; box-shadow: none; background: #fff; text-shadow: none; overflow: visible; }
    .screen::before, .screen::after, .tabs, .viewswitch, .cta, .skip, .portrait, .bottom { display: none; }
    [role="tabpanel"], [role="tabpanel"][hidden] { display: block; height: auto; overflow: visible; padding: .5rem 0; animation: none; }
    .job, .quest, .inv { break-inside: avoid; }
}

/* ---------- Elasticsearch emphasis ---------- */
.core {
    font-family: var(--mono);
    font-size: .95rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--warn);
    border: 1px solid var(--warn);
    padding: 0 .35rem;
    margin-left: .4rem;
    vertical-align: middle;
}
.inv-core { border-color: var(--fg); grid-column: span 2; }
.kpis {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .75rem;
    max-width: 980px;
    margin-bottom: 1rem;
}
ul.kpis > li { padding: .6rem .8rem !important; margin: 0 !important; border: 1px solid var(--line); border-radius: 10px; }
ul.kpis > li::before { content: none !important; }
.kpis b { display: block; font-family: var(--mono); font-weight: 400; font-size: 2.2rem; line-height: 1; }
.kpis span { color: var(--dim); font-size: .85rem; }
@media (max-width: 720px) {
    .inv-core { grid-column: auto; }
    .kpis { grid-template-columns: 1fr 1fr; }
}

/* ---------- game bits ---------- */
.plain .pip-only, .pip-only.plain-only, :root:not(.plain) .plain-only { display: none; }
.plain .when-pip, :root:not(.plain) .when-plain { display: none; }
.plain [role="tab"] .k { display: none; }
.plain [role="tab"] { font-size: 1rem; padding: .55rem 1rem .5rem; }

.boot {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--bg);
    color: var(--fg);
    text-shadow: var(--glow);
    display: grid;
    align-content: center;
    justify-content: center;
    padding: 1rem;
    transition: opacity .35s, transform .35s;
}
.boot pre { font-family: var(--mono); font-size: clamp(1.05rem, 2.4vw, 1.6rem); line-height: 1.25; min-width: min(36ch, 90vw); white-space: pre-wrap; }
.boot pre::after { content: "█"; animation: pulse .7s step-end infinite; }
.boot.off { opacity: 0; transform: scaleY(.02); }
.boot[hidden] { display: none; }

.xp {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1.1rem;
    max-width: 62ch;
    font-family: var(--mono);
    font-size: 1.2rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.xp b { font-weight: 400; color: var(--fg-strong); }
.xp .bar { flex: 1; height: .7rem; border: 1px solid var(--fg); padding: 1px; }
.xp .fill {
    display: block;
    height: 100%;
    width: 0;
    background: repeating-linear-gradient(90deg, var(--fg) 0 6px, transparent 6px 8px);
    transition: width 1.2s steps(16);
}
.xp-next { color: var(--dim); font-size: 1rem; white-space: nowrap; }
.plain .xp { display: none; }

/* Pip-Boy list selection: hovered item inverts, like picking an item in the inventory */
.chips li { transition: background .08s steps(2), color .08s steps(2); }
:root:not(.plain) .chips li:hover { background: var(--fg); color: var(--screen); text-shadow: none; }
:root:not(.plain) .chips li:hover::before { content: "▸ "; }

.tag-dim { color: var(--dim); border-color: var(--dim); }
.quest-active { border-style: dashed; }

/* professional view drops the pixel font too, and reads at a normal text size */
.plain { font-size: clamp(14px, 0.25vw + 12px, 15.5px); --mono: "Chakra Petch", system-ui, sans-serif; }
.plain h1 { font-weight: 600; font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: 0; text-transform: none; }
.plain h2 { font-weight: 600; font-size: 1.5rem; letter-spacing: .02em; }
.plain .role, .plain h4, .plain .facts dt, .plain .when, .plain .links a, .plain .tag, .plain .core,
.plain .pill, .plain .viewswitch, .plain .btn, .plain .bottom, .plain .freq, .plain .term { font-size: .85rem; letter-spacing: .04em; }
.plain h4 { font-weight: 600; }
.plain .kpis b { font-weight: 600; font-size: 1.7rem; }
.plain .term { font-family: ui-monospace, Menlo, monospace; text-transform: none; }

/* nudge the switch thumb toward the other side a few times so people notice it, until they use it */
.viewswitch.nudge .thumb { animation: nudge 1.2s ease-in-out 2.4s 3; }
.viewswitch[aria-checked="true"].nudge .thumb { animation-name: nudge-back; }
@keyframes nudge {
    0%, 55%, 100% { transform: translateX(0%); }
    18% { transform: translateX(22%); }
    32% { transform: translateX(0%); }
    42% { transform: translateX(8%); }
}
@keyframes nudge-back {
    0%, 55%, 100% { transform: translateX(100%); }
    18% { transform: translateX(78%); }
    32% { transform: translateX(100%); }
    42% { transform: translateX(92%); }
}

/* very narrow phones */
@media (max-width: 360px) {
    h1, .plain h1 { font-size: 1.7rem; }
    [role="tab"] { padding: .3rem .4rem .25rem; font-size: .66rem; }
    [role="tab"] .k { font-size: 1.15rem; }
    [role="tablist"] { gap: 0; }
    .kpis { grid-template-columns: 1fr 1fr; }
    .kpis b { font-size: 1.8rem; }
}

/* short screens (phones in landscape): let the whole page scroll instead of the panel */
@media (max-height: 520px) {
    body { overflow: auto; place-items: start center; }
    .screen { height: auto; min-height: 100dvh; width: 100vw; border-radius: 0; border-width: 0; overflow: visible; }
    .tabs { position: sticky; top: 0; z-index: 6; background: var(--screen); }
    [role="tabpanel"] { height: auto; overflow: visible; }
    .top { padding-top: .6rem; padding-bottom: .4rem; }
    .role { display: none; }
    .stat-grid { grid-template-columns: 140px 1fr; gap: 1.2rem; }
    .portrait { max-width: 140px; }
    .screen::before, .screen::after { position: fixed; }
}
@media (max-width: 480px) {
    .plain [role="tab"] { font-size: .8rem; padding: .45rem .45rem .4rem; }
    .plain [role="tablist"] { gap: 0; }
}
