/* Josefin Sans (SIL Open Font License, see fonts/OFL.txt), served from this site instead of Google Fonts */
@font-face {
  font-family: "Josefin Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/josefin-sans-semibold.woff") format("woff");
}
@font-face {
  font-family: "Josefin Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/josefin-sans-bold.woff") format("woff");
}

:root {
    /* Space theme — matches the portfolio site */
    color-scheme: dark;
    --bg: #0b0d21;
    --bg-2: #141737;
    --surface: rgba(23, 26, 54, 0.82);
    --ink: #e8e6f5;
    --ink-2: #c3c2d8;
    --muted: #a9a6c4;
    --line: rgba(185, 166, 255, 0.22);
    --accent: #b9a6ff;        /* links, selected states */
    --accent-strong: #6d4bff; /* buttons */
    --accent-ink: #ffffff;
    --danger: #e66767;
    --series-1: #3987e5;
    --series-2: #d95926;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    line-height: 1.5;
    background-color: var(--bg);
    background-image:
        radial-gradient(1px 1px at 20px 30px, #fff, transparent),
        radial-gradient(1px 1px at 140px 80px, rgba(255,255,255,.8), transparent),
        radial-gradient(1.5px 1.5px at 90px 160px, #d6cbff, transparent),
        radial-gradient(1px 1px at 200px 220px, rgba(255,255,255,.7), transparent),
        radial-gradient(1px 1px at 260px 40px, rgba(255,255,255,.6), transparent),
        radial-gradient(1.5px 1.5px at 330px 190px, #fff, transparent),
        radial-gradient(ellipse at 80% -10%, rgba(109, 75, 255, .35), transparent 55%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-size: 360px 260px, 360px 260px, 360px 260px, 360px 260px, 360px 260px, 360px 260px, 100% 100%, 100% 100%;
    background-attachment: fixed;
    min-height: 100vh;
}
a:hover { color: #d6cbff; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; outline: none; font-family: "Josefin Sans", system-ui, sans-serif; font-weight: 600; letter-spacing: .02em; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
h2:first-child { margin-top: 0; }
small, .muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.loading { text-align: center; margin-top: 30vh; font-size: 1.2rem; }

/* Site-wide bar (matches the portfolio's top navigation) */
.sitebar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: .5rem 1.5rem;
    padding: .6rem 1rem; background: rgba(11, 13, 33, 0.75); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font-family: "Josefin Sans", system-ui, sans-serif; font-weight: 600; font-size: 1.25rem; text-decoration: none; color: #fff; }
.brand:hover { color: #d6cbff; }
.sitebar nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.sitebar nav a { text-decoration: none; color: var(--accent); }
.sitebar nav a:hover { color: #d6cbff; }
.sitebar nav a.current { color: #fff; }

/* Journal's own sections */
.journalbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25rem 1.1rem;
    padding: .55rem 1rem; border-bottom: 1px solid var(--line);
}
.journal-title { font-family: "Josefin Sans", system-ui, sans-serif; font-weight: 600; color: var(--ink); margin-right: .5rem; }
.journalbar a { text-decoration: none; color: var(--accent); }
.journalbar a:hover { color: #d6cbff; }
.journalbar a.active { color: #fff; font-weight: 600; text-shadow: 0 0 10px rgba(185,166,255,.8); }

.page { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.card { padding: .5rem 0; margin-bottom: 1.25rem; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.choice {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .6rem .25rem; border: 2px solid var(--line); border-radius: 10px;
    background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: .85rem;
}
.choice .emoji { font-size: 1.7rem; line-height: 1; }
.choice.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset, 0 0 14px rgba(185,166,255,.45); }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.tag {
    border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem;
    background: var(--surface); color: var(--ink-2); font: inherit; font-size: .85rem; cursor: pointer;
}
.tag.selected { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.tag.static { cursor: default; }

textarea {
    width: 100%; padding: .6rem; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--ink); font: inherit; margin-bottom: .75rem;
}
button { font: inherit; cursor: pointer; border-radius: 8px; padding: .55rem 1rem; margin: .25rem .4rem .25rem 0; }
button.primary { background: var(--accent-strong); color: var(--accent-ink); border: none; width: 100%; font-weight: 600; }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.danger { background: var(--danger); color: #fff; border: none; }
button.link { background: none; border: none; color: var(--muted); padding: 0; text-decoration: underline; }
.button-link { margin-left: .5rem; }
.big { font-size: 1.4rem; margin: 0 0 .5rem; }
.notice { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-radius: 8px; padding: .6rem .8rem; }
.switch { display: flex; gap: .5rem; align-items: center; font-weight: 600; }
.file { display: block; margin-top: .75rem; }

.history { list-style: none; padding: 0; margin: 0; }
.history .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.history .note { white-space: pre-wrap; margin: .5rem 0; }

/* Chart */
.viz-root { margin: 0 0 1rem; }
.viz-root svg { width: 100%; height: auto; display: block; }
.viz-root .grid { stroke: rgba(185, 166, 255, 0.14); stroke-width: 1; }
.viz-root .axis { fill: var(--muted); font-size: 12px; }
.viz-root .axis.small { font-size: 10px; }
.viz-root .dot { stroke: #171a36; stroke-width: 2; }
.viz-root .dot.s1, .swatch.s1 { fill: var(--series-1); background: var(--series-1); }
.viz-root .dot.s2, .swatch.s2 { fill: var(--series-2); background: var(--series-2); }
.viz-root .whisker { stroke-width: 2; stroke-linecap: round; }
.viz-root .whisker.s1 { stroke: var(--series-1); }
.viz-root .whisker.s2 { stroke: var(--series-2); }
.viz-root .hit { fill: transparent; }
.viz-root .hit:hover + * , .viz-root circle.hit:hover { stroke: var(--ink-2); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--ink-2); margin-bottom: .5rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; }
.viz-root table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: .5rem; }
.viz-root th, .viz-root td { text-align: left; padding: .3rem .4rem; border-bottom: 1px solid var(--line); }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%; padding: .6rem 1.25rem;
    background: #ffe9a8; color: #1b1d3a; box-shadow: 0 -1px 2px rgba(0,0,0,.2); z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
