/* =============================================================================
   brackets.hr — Stjepan Petrusa
   Hand-written CSS. Native nesting + custom properties, no preprocessor.
   Direction: Swiss-poster brutalism. Poster-scale weight 900 display type,
   3px rules, the accent used as blocks rather than as trim.
   ========================================================================== */

/* ── Font ───────────────────────────────────────────────────────────────────
   Inter, SIL Open Font License 1.1, self-hosted so the page makes zero
   third-party requests. Variable (wght 100–900) — Google serves Inter
   variable-only, so one file covers every weight used here.

   Latin subset ONLY. The latin-ext file was dropped once the last diacritic
   left the page; nothing rendered here falls in that range any more. Add a
   Croatian character (š č ć ž đ) and it will silently fall back to a system
   font — see the Fonts section of README.md for how to put latin-ext back.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-var-latin.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F,
    U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Type — display sizes are deliberately close to the viewport ceiling. */
  --t-name: clamp(3.5rem, 0.5rem + 13.5vw, 13rem);
  --t-title: clamp(2.25rem, 1.2rem + 4vw, 5rem);
  --t-num: clamp(1.125rem, 0.9rem + 1.1vw, 2.25rem);
  --t-lede: clamp(1.375rem, 1rem + 1.4vw, 2.125rem);
  --t-year: clamp(1.5rem, 1rem + 2vw, 2.75rem);
  --t-mail: clamp(1.5rem, 0.4rem + 5vw, 4.5rem);
  --t-body: 1.0625rem;
  --t-meta: 0.75rem;

  --track-tight: -0.035em;
  --track-meta: 0.14em;

  /* Space */
  --pad: clamp(1.25rem, 0.5rem + 3.2vw, 4.5rem);
  --bar-h: 4.25rem;
  --gap-block: clamp(4.5rem, 3rem + 8vw, 11rem);
  --measure: min(100%, 58rem);

  --rule-w: 3px;
  --ease: cubic-bezier(0.16, 0.84, 0.12, 1);

  /* ── Light: bone paper, hard black, hot vermilion ── */
  --bg: #f2efe9;
  --ink: #0c0c0c;
  --muted: #5e5b55;
  --accent: #ff3b0f;
  /* The bright vermilion is 3.1:1 on bone — fine for poster-scale type (needs
     3:1) but short of the 4.5:1 small text needs. Darker sibling for the small
     accent text only, so the display colour keeps its punch. */
  --accent-ink: #c22600;
  --on-accent: #0c0c0c;
  --rule: #0c0c0c;
  --hair: #0c0c0c26;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0c0c0c;
    --ink: #f2efe9;
    --muted: #9a968e;
    --accent: #ff4a1c;
    --accent-ink: #ff4a1c; /* 5.8:1 on near-black — no darker variant needed */
    --on-accent: #0c0c0c;
    --rule: #f2efe9;
    --hair: #f2efe940;
  }
}

:root[data-theme='dark'] {
  --bg: #0c0c0c;
  --ink: #f2efe9;
  --muted: #9a968e;
  --accent: #ff4a1c;
  --accent-ink: #ff4a1c;
  --on-accent: #0c0c0c;
  --rule: #f2efe9;
  --hair: #f2efe940;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.55;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color 300ms var(--ease), color 300ms var(--ease);
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

:where(a, button):focus-visible {
  outline: var(--rule-w) solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 200;
  padding: 0.85rem 1.25rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--t-meta);
  font-weight: 900;
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  transform: translateY(-120%);
  transition: transform 180ms var(--ease);

  &:focus-visible {
    transform: translateY(0);
    outline-offset: -6px;
  }
}

/* Shared uppercase micro-label. */
.hero__kicker,
.switch,
.bar__contact,
.end__label,
.end__links,
.aside,
.end__note {
  font-size: var(--t-meta);
  font-weight: 600;
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
}

/* ── Fixed bar ──────────────────────────────────────────────────────────── */

.bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--pad);
  background: var(--bg);
  border-bottom: var(--rule-w) solid var(--rule);
  transition: background-color 300ms var(--ease), border-color 300ms var(--ease);
}

.bar__mark {
  font-size: 1.0625rem;
  font-weight: 900;
  letter-spacing: -0.02em;

  & .bar__br {
    color: var(--accent-ink);
    display: inline-block;
    transition: transform 260ms var(--ease);
  }

  &:hover .bar__br:first-of-type {
    transform: translateX(-0.18em);
  }
  &:hover .bar__br:last-of-type {
    transform: translateX(0.18em);
  }
}

.bar__right {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.75rem);
}

/* Hard-edged box that fills as it flips. No border-radius anywhere. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;

  & .switch__box {
    position: relative;
    flex: none;
    width: 0.875rem;
    height: 0.875rem;
    border: 2px solid var(--ink);
    overflow: hidden;
    transition: border-color 200ms var(--ease);

    &::after {
      content: '';
      position: absolute;
      inset: -1px;
      background: var(--accent);
      clip-path: inset(0 0 0 50%);
      transition: clip-path 320ms var(--ease);
    }
  }

  &:hover .switch__box {
    border-color: var(--accent);
  }
}

:root[data-theme='dark'] .switch__box::after {
  clip-path: inset(0);
}
:root[data-theme='light'] .switch__box::after {
  clip-path: inset(0 50% 0 0);
}

.bar__contact {
  position: relative;
  padding-bottom: 2px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% var(--rule-w);
  transition: background-size 260ms var(--ease);

  &:hover,
  &:focus-visible {
    background-size: 100% var(--rule-w);
  }
}

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  padding: calc(var(--bar-h) + clamp(2.5rem, 6vw, 6rem)) var(--pad) clamp(2.5rem, 5vw, 4.5rem);
}

.hero__kicker {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--muted);
  margin-bottom: clamp(1.25rem, 3vw, 2.5rem);

  & i {
    width: clamp(1.5rem, 6vw, 4rem);
    height: 2px;
    background: var(--accent);
  }
}

/* The point of the whole page: one enormous, tightly-tracked name. */
.hero__name {
  font-size: var(--t-name);
  font-weight: 900;
  /* Was 0.99 to clear the caron on Š (ink ascent 0.954em). With the name spelled
     "Petrusa" the tallest ink on line two is now plain cap height (S = 0.737em),
     so the poster can close back up. Restore ~0.99 if the caron ever returns. */
  line-height: 0.84;
  letter-spacing: var(--track-tight);
  text-transform: uppercase;
  text-wrap: balance;
}

.hero__line {
  display: block;

  /* Second line pushed right and set in the accent — asymmetry on purpose. */
  &:last-child {
    color: var(--accent);
    margin-left: clamp(0rem, 8vw, 8rem);
  }
}

.hero__sub {
  max-width: 40ch;
  margin-top: clamp(1.5rem, 3vw, 2.75rem);
  font-size: var(--t-lede);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

/* ── Ticker ─────────────────────────────────────────────────────────────── */

.ticker {
  overflow: hidden;
  border-top: var(--rule-w) solid var(--rule);
  border-bottom: var(--rule-w) solid var(--rule);
  background: var(--accent);
  color: var(--on-accent);
}

.ticker__track {
  display: flex;
  width: max-content;
}

.ticker__row {
  flex: none;
  padding: 0.7rem 0;
  font-size: clamp(1rem, 0.8rem + 1vw, 1.75rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;

  & b {
    padding: 0 0.7em;
    font-weight: 400;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .ticker__track {
    animation: slide 34s linear infinite;
  }

  @keyframes slide {
    to {
      /* Two identical rows, so -50% of the track is one seamless cycle. */
      transform: translateX(-50%);
    }
  }
}

/* ── Blocks ─────────────────────────────────────────────────────────────── */

.block {
  padding: var(--gap-block) var(--pad) 0;
  scroll-margin-top: calc(var(--bar-h) + 1rem);
}

.block__head {
  display: flex;
  align-items: baseline;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  padding-bottom: clamp(1rem, 2vw, 1.75rem);
  border-bottom: var(--rule-w) solid var(--rule);
  margin-bottom: clamp(1.75rem, 4vw, 3.5rem);
}

.block__num {
  flex: none;
  font-size: var(--t-num);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.block__title {
  font-size: var(--t-title);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: var(--track-tight);
  text-transform: uppercase;
}

.block__body {
  max-width: var(--measure);
}

/* Sized in the lede's own em, not the body's ch — at 34px it needs ~880px to
   land on three lines instead of five stubby ones. */
.lede {
  max-width: 26em;
}

.lede {
  font-size: var(--t-lede);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  text-wrap: pretty;
}

/* :where() so this contributes no specificity — otherwise (0,2,1) here would
   outrank .job--now .job__years at (0,2,0) and eat the accent colour. */
.block__body :where(p:not(.lede)) {
  color: var(--muted);
  line-height: 1.65;
  max-width: 38em;
  text-wrap: pretty;
}

/* ── Jobs ───────────────────────────────────────────────────────────────── */

.jobs {
  display: flex;
  flex-direction: column;
  gap: clamp(2.25rem, 4vw, 3.5rem);
}

.job {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--hair);
}

.job__years {
  max-width: none; /* same reason as .job__role */
  font-size: var(--t-year);
  font-weight: 900;
  line-height: 1;
  letter-spacing: var(--track-tight);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.job--now .job__years {
  color: var(--accent);
}

.job__org {
  font-size: clamp(1.375rem, 1rem + 1.4vw, 2.125rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 0.3rem;
}

/* The role line doubles as a career path: one step per role, arrows between,
   current role picked out in the accent. Must sit after
   `.block__body :where(p:not(.lede))` — that rule is (0,1,0) and so is this
   one, so source order is what keeps the colour. */
/* Meta line, so it sets its own measure — the blanket `:where(p:not(.lede))`
   max-width is 38em sized for 17px body copy, which at 12px is only 456px. */
.job__role {
  max-width: none;
  margin-bottom: 0.75rem;
  font-size: var(--t-meta);
  font-weight: 600;
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  color: var(--muted);
}

.job--now .job__role {
  color: var(--accent-ink);
}
.job__note {
  color: var(--muted);
  line-height: 1.65;
}

.aside {
  margin-top: clamp(2.25rem, 4vw, 3.5rem);
  padding-top: 1.25rem;
  border-top: 2px solid var(--hair);
  color: var(--muted);
}

/* ── Works ──────────────────────────────────────────────────────────────── */

.works {
  display: flex;
  flex-direction: column;
}

.work {
  padding: 1.5rem 0;
  border-top: 2px solid var(--hair);

  &:last-child {
    border-bottom: 2px solid var(--hair);
  }
}

.work__title {
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.875rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.work__note {
  margin-top: 0.4rem;
  color: var(--muted);
  line-height: 1.6;
}

.work__ext {
  display: inline-block;
  margin-left: 0.6em;
  padding: 0.2em 0.45em;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.5625rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  vertical-align: 0.3em;
}

/* ── Links: the accent block slides up behind the text ──────────────────── */

.pill {
  position: relative;
  display: inline-block;
  padding: 0 0.14em;
  isolation: isolate;

  &::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--accent);
    transform: scaleY(0.08);
    transform-origin: bottom;
    transition: transform 260ms var(--ease);
  }

  &:hover,
  &:focus-visible {
    color: var(--on-accent);
  }

  &:hover::before,
  &:focus-visible::before {
    transform: scaleY(1);
  }
}

/* ── End ────────────────────────────────────────────────────────────────── */

.end {
  margin-top: var(--gap-block);
  padding: clamp(2.5rem, 5vw, 5rem) var(--pad) clamp(3rem, 6vw, 6rem);
  border-top: var(--rule-w) solid var(--rule);
}

.end__label {
  color: var(--muted);
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.end__mail {
  display: inline-block;
  font-size: var(--t-mail);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: var(--track-tight);
  text-transform: uppercase;
  overflow-wrap: anywhere;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% var(--rule-w);
  transition: background-size 320ms var(--ease);

  &:hover,
  &:focus-visible {
    background-size: 100% var(--rule-w);
  }
}

.end__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: clamp(2rem, 4vw, 3rem);
}

.end__note {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  max-width: 32ch;
  color: var(--muted);
  line-height: 1.9;
  letter-spacing: 0.1em;
}

/* ── Print ──────────────────────────────────────────────────────────────── */

@media print {
  .bar,
  .ticker,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .hero {
    padding-top: 0;
  }

  .block {
    padding-inline: 0;
    break-inside: avoid;
  }
}
