/* Site Noir — overrides on top of d4-gradient.css for the full page */

html, body, #root { background: #11100d; }
.site-body { margin: 0; }

/* Override D4 hero grid — Noir stacks meta + headline + bio-grid + worklog */
.gr-root .gr-hero {
  display: block;
}
.gr-root .gr-hero-meta {
  margin-bottom: 32px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--acc);
  letter-spacing: 0.04em;
}
.gr-root .gr-headline {
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: -0.03em;
  min-height: auto;
}

/* Subhead — runs the token-stream */
.sn-subhead {
  font-family: 'Instrument Serif', 'Times New Roman', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 52px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  margin-bottom: 56px;
  text-wrap: balance;
  min-height: 1.2em;
}

/* Bio row: portrait card LEFT, bio text RIGHT */
.gr-bio-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: stretch;
  gap: 48px;
}

.sn-portrait-card {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
}

.gr-bio { grid-column: auto; }

.sn-bio-col {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

.sn-portrait {
  margin: 0;
  border: 1px solid var(--rule);
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
}
.sn-portrait img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 40% 30%;
  filter: grayscale(1) contrast(1.05) brightness(1.0);
  opacity: 0.95;
}
.sn-portrait::after {
  /* faint scanline overlay only — kept subtle, no color blend */
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(168,255,96,0.025) 3px 4px),
    radial-gradient(ellipse at 30% 0%, rgba(168,255,96,0.06), transparent 60%);
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 1;
}
.sn-portrait-cap {
  position: absolute;
  bottom: 10px; left: 12px; right: 12px;
  display: flex; justify-content: space-between;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--acc);
  z-index: 2;
  text-transform: lowercase;
  pointer-events: none;
}
.sn-portrait-cap span {
  background: rgba(17, 16, 13, 0.62);
  padding: 1px 4px;
  border-radius: 1px;
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}

.sn-id {
  border: 1px solid var(--rule);
  background: var(--bg-2);
  padding: 14px 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
}
.sn-id-row {
  display: flex; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--rule);
  gap: 12px;
}
.sn-id-row:last-child { border-bottom: 0; }
.sn-id-row > span:first-child { color: var(--ink-dim); letter-spacing: 0.08em; }
.sn-id-row > span:last-child { color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 1100px) {
  .gr-bio-grid { grid-template-columns: 1fr; }
  .sn-portrait-card { grid-column: 1; }
  .sn-bio-col { grid-column: 1; }
}

/* WORK LOG ($ tail -f work.log) */
.sn-worklog {
  /* override d4-gradient's .gr-gutter grid placement */
  grid-column: auto !important;
  grid-row: auto !important;
  margin-top: 0;
  min-height: auto;
}

.sn-id-row-wrap {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-auto-rows: min-content;
  gap: 48px;
  margin-top: 32px;
  align-items: stretch;
}
.sn-worklog-clip {
  position: relative;
  overflow: hidden;
  min-height: 0;
  /* fade the overflowing rows out at the bottom */
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 70%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0, #000 70%, transparent 100%);
}
.sn-worklog-clip > .sn-worklog {
  position: absolute;
  inset: 0;
}
@media (max-width: 1100px) {
  .sn-id-row-wrap { grid-template-columns: 1fr; }
}
.sn-worklog .gr-gutter-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--acc);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
}
.sn-worklog-live {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--acc); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.sn-log-row {
  display: grid;
  grid-template-columns: 80px 90px 1fr;
  gap: 14px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.6;
  padding: 2px 0;
  transition: opacity 0.5s ease;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.sn-log-ts {
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.sn-log-tag {
  font-weight: 500;
  letter-spacing: 0.02em;
}
.sn-log-msg { color: var(--ink-2); }
.sn-log-row:first-child .sn-log-msg { color: var(--ink); }
.sn-log-row:first-child {
  animation: sn-log-in 0.4s ease-out;
}
@keyframes sn-log-in {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: none; }
}

/* MOBILE — header restacks, side padding tightens, hero/section spacing shrinks.
   The d4-gradient header is a 3-column grid that overflows on narrow viewports
   because the right column ("Helsingborg / Lund · SE") doesn't have room next
   to the centered nav. Switch to a two-row layout under 900px. */
@media (max-width: 900px) {
  .gr-root { padding: 0 24px; }

  .gr-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "mark   status"
      "nav    nav";
    row-gap: 14px;
    column-gap: 16px;
    padding: 18px 0;
  }
  .gr-mark   { grid-area: mark; }
  .gr-status { grid-area: status; justify-self: end; font-size: 11px; }
  .gr-nav    { grid-area: nav; justify-content: flex-start; gap: 22px; flex-wrap: wrap; }

  .gr-hero { padding: 56px 0 64px; }
  .gr-section { padding: 56px 0; }
  .gr-contact { padding: 64px 0; }

  /* Pub list collapses the side year column under the body */
  .gr-pubs li { grid-template-columns: 1fr; gap: 12px; }
  .gr-pub-side { flex-direction: row; align-items: baseline; gap: 12px; }
  .gr-pub-yr { font-size: 24px; }

  /* Packages: drop the long description column on narrow screens */
  .gr-pkg a { grid-template-columns: 32px 1fr 16px; }
  .gr-pkg-desc { display: none; }
}

@media (max-width: 480px) {
  .gr-root { padding: 0 16px; }
  .gr-header { padding: 14px 0; }
  .gr-status > span:not(.gr-pulse) { font-size: 10px; }
  .gr-nav { gap: 16px; font-size: 12px; }
}

/* Decorative SVG fragment, sized like a line of italic display text. */
.sn-frag {
  display: block;
  height: clamp(28px, 2.6vw, 40px);
  width: auto;
  max-width: 100%;
  margin: 0 0 32px;
  user-select: none;
  pointer-events: none;
}
/* Tighten the gap between the "Contact" heading and the fragment graphic. */
.gr-contact .gr-section-head { margin-bottom: 24px; }

/* ROLLING HEADLINE */
.sn-rolling {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.18em;
  /* keep d4 .gr-headline font/size/line-height intact */
}
.sn-rolling-static {
  /* sits inline with the rolling word */
}
.sn-rolling-window {
  display: inline-block;
  position: relative;
  height: 1.1em;
  overflow: hidden;
  vertical-align: top;
}
.sn-rolling-track {
  display: flex;
  flex-direction: column;
  transition: transform 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}
.sn-rolling-word {
  display: block;
  height: 1.1em;
  line-height: 1.1;
  white-space: nowrap;
}
