/* dkorunic.net — "phosphor terminal" theme. Single shared stylesheet.
   Dark by default, light "paper" variant; auto-matches the OS via
   prefers-color-scheme and can be overridden via [data-theme] on <html>. */

:root {
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 960px;
  --radius: 10px;

  color-scheme: dark;
  --bg:        #0c0f0d;
  --surface:   #121713;
  --border:    #1f2a22;
  --text:      #c4cec6;
  --text-dim:  #7d8a80;
  --heading:   #eef5ef;
  --accent:    #4ade80;   /* phosphor green */
  --amber:     #fbbf24;   /* prompt path */
  --glow:      rgba(74, 222, 128, 0.12);
  --header-bg: rgba(12, 15, 13, 0.8);
}

/* Light palette — kept in sync between the manual override and the auto match. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:        #faf8f3;
  --surface:   #ffffff;
  --border:    #e4e0d6;
  --text:      #3a3f3b;
  --text-dim:  #6b716c;
  --heading:   #111613;
  --accent:    #15803d;
  --amber:     #a16207;
  --glow:      rgba(21, 128, 61, 0.08);
  --header-bg: rgba(250, 248, 243, 0.85);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg:        #faf8f3;
    --surface:   #ffffff;
    --border:    #e4e0d6;
    --text:      #3a3f3b;
    --text-dim:  #6b716c;
    --heading:   #111613;
    --accent:    #15803d;
    --amber:     #a16207;
    --glow:      rgba(21, 128, 61, 0.08);
    --header-bg: rgba(250, 248, 243, 0.85);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: radial-gradient(60rem 30rem at 15% -10%, var(--glow), transparent 60%) var(--bg);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, .brand, .cmd, .nav, code, .files, .kv dt, .chips { font-family: var(--font-mono); }
h1, h2 { color: var(--heading); line-height: 1.2; }

.p-user { color: var(--accent); }
.p-path { color: var(--amber); }
.p-dim  { color: var(--text-dim); }

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--bg); padding: .6rem 1rem; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.75rem; }
.brand { font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.nav { display: flex; flex-wrap: wrap; gap: .1rem .9rem; font-size: .9rem; }
.nav a { color: var(--text-dim); }
.nav a::before { content: "./"; opacity: .5; }
.nav a:hover { color: var(--accent); text-decoration: none; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--heading); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; display: none; }
.theme-toggle[data-mode="auto"] .ico-auto,
.theme-toggle[data-mode="light"] .ico-sun,
.theme-toggle[data-mode="dark"] .ico-moon { display: block; }

/* Hero -------------------------------------------------------------------- */

.hero { padding: clamp(3rem, 10vw, 6.5rem) 0 clamp(2rem, 6vw, 3.5rem); }
.cmd { margin: 0 0 1rem; font-size: clamp(.95rem, 2.5vw, 1.15rem); }
.cursor {
  display: inline-block; width: .6em; height: 1.1em; margin-left: .25em;
  vertical-align: text-bottom; background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

.hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); margin: 0 0 1rem; letter-spacing: -.02em; }
.lead { font-size: clamp(1.05rem, 2.2vw, 1.2rem); max-width: 40rem; margin: 0 0 1.75rem; }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; font-size: .9rem; }
.chips a {
  display: inline-block; padding: .35rem .8rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--heading);
}
.chips a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Sections ---------------------------------------------------------------- */

.section { padding: clamp(2rem, 6vw, 3.5rem) 0; border-top: 1px dashed var(--border); }
.section h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); margin: 0 0 .5rem; }
.intro { color: var(--text-dim); margin: 0 0 1.5rem; max-width: 42rem; }
.more { margin: 1rem 0 0; font-family: var(--font-mono); font-size: .9rem; }

/* `ls -l`-style file listing */
.files { list-style: none; padding: 0; margin: 0; font-size: .9rem; columns: 2 26rem; column-gap: 2.5rem; }
.files li {
  display: grid; grid-template-columns: 3.5rem 1fr auto; gap: .75rem; align-items: baseline;
  padding: .3rem 0; border-bottom: 1px solid var(--border); break-inside: avoid;
}
.f-year, .f-size { color: var(--text-dim); font-size: .8rem; }
.files a { color: var(--text); overflow-wrap: anywhere; }
.files a:hover { color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.card {
  display: flex; flex-direction: column; gap: .4rem; padding: 1.1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); transition: border-color .15s ease, transform .15s ease;
}
.card strong { font-family: var(--font-mono); color: var(--accent); }
.card span { font-size: .92rem; color: var(--text-dim); }
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; margin: 0; }
.kv dt { color: var(--text-dim); font-size: .9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 34rem) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: .6rem; } }

/* Astrophotography -------------------------------------------------------- */

.hero-sub { padding-bottom: clamp(1.5rem, 4vw, 2.5rem); }
/* Photos break out of the text column: up to 90rem wide, centred on the
   same axis as the column, and never taller than the viewport. Sized in
   cqw of the full-width article rather than vw, which counts the scrollbar
   and would leave photos a few pixels wider than the text. */
.astro { container-type: inline-size; }
.astro-img {
  --w: min(calc(100cqw - 2 * clamp(1rem, 4vw, 2rem)), 90rem);
  display: block; width: var(--w); margin: 0 0 1.5rem calc(50% - var(--w) / 2);
}
/* --ar (width/height) is set per image so the width is known before load. */
.astro-img img { width: min(100%, 85vh * var(--ar)); margin-inline: auto; }
.astro-img img, .astro-grid img {
  display: block; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius); background: #000;
}
.astro-grid img { width: 100%; }
.astro-img:hover img, .astro-grid a:hover img { border-color: var(--accent); }
.astro-ids { margin: -.25rem 0 1rem; font-family: var(--font-mono); font-size: .9rem; color: var(--amber); }
.astro p:not(.astro-ids) { max-width: 46rem; }
.astro .kv { margin-top: 1.5rem; font-size: .92rem; }

.viewer {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: rgba(0, 0, 0, .92); cursor: zoom-out;
}
.viewer::backdrop { background: rgba(0, 0, 0, .6); }
.viewer img { width: 100%; height: 100%; object-fit: contain; }
.astro-img { cursor: zoom-in; }

.astro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1rem; }
.astro-grid a { display: flex; flex-direction: column; gap: .4rem; font-family: var(--font-mono); font-size: .85rem; color: var(--text-dim); }
.astro-grid a:hover { color: var(--accent); text-decoration: none; }
.astro-grid img { aspect-ratio: 4 / 3; }

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

.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; font-size: .85rem; color: var(--text-dim); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }

/* Phones hide the section nav; subpages show a plain way back home instead. */
.home-link { display: none; font-family: var(--font-mono); font-size: .9rem; color: var(--text-dim); }
.home-link:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 40rem) {
  .nav { display: none; }
  .home-link { display: inline; }
}

.card .lang { margin-top: auto; padding-top: .3rem; font-style: normal; font-family: var(--font-mono); font-size: .75rem; color: var(--amber); }
