/* jostarzoo.com: "Specfile" style.
   Monospace for the site name, nav, headings, and labels; system sans for body text.
   Colors are tokens; dark values switch with the visitor's system setting.

   Screen sizes: text, gutters, and spacing scale with the screen. Layouts step up at
   36em (two-column skills), 40em (cards in a row, portfolio labels beside text),
   64em (home hero beside skills, About me in two columns), and 72em (portfolio
   sections in three columns). Short landscape screens get tighter spacing.
   Check every size with: python3 tests/preview.py --check */

:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --text: #1b1d22;
  --text-muted: #5a616d;
  --accent: #a14a06;
  --accent-contrast: #ffffff;
  --border: #d7dbe1;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --content-width: 88rem;                         /* cap on very wide screens */
  --gutter: clamp(1rem, 0.5rem + 3vw, 3.5rem);    /* space at the screen edges */
  --space: clamp(2rem, 1rem + 4vh, 4.5rem);       /* space between page sections */

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1d2027;
    --text: #e8e6e1;
    --text-muted: #a2a6ae;
    --accent: #f0a53a;
    --accent-contrast: #15171c;
    --border: #2f333c;
  }
}

/* short landscape screens (phones on their side): less vertical padding */
@media (orientation: landscape) and (max-height: 30em) {
  :root {
    --space: 1.75rem;
  }
}

/* ---------- base ---------- */

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

/* 16px on phones, growing to 20px on large desktops; still follows browser zoom */
html {
  font-size: clamp(100%, 0.85rem + 0.25vw, 125%);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-mono);
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: break-word;
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
  font-weight: 600;
}

/* cursor after each page title; hidden from screen readers */
h1::after {
  content: "_";
  content: "_" / "";
  color: var(--accent);
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

p {
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ---------- page frame ---------- */

.site-header,
.container,
.site-footer {
  width: min(100% - 2 * var(--gutter), var(--content-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: clamp(1rem, 3vh, 2rem);
}

.site-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a[aria-current="page"]::before {
  content: "> ";
  content: "> " / "";
  color: var(--accent);
}

/* foldable cover screens and other very narrow phones */
@media (max-width: 22em) {
  .site-nav {
    gap: 0.2rem 0.9rem;
    font-size: 0.85rem;
  }
}

.container {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--space);
  padding-block: var(--space);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-block: 1.25rem clamp(1.25rem, 4vh, 2.5rem);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer .copyright {
  margin-left: auto;
}

/* ---------- sections ---------- */

.section {
  min-width: 0;
  display: grid;
  gap: 1rem;
  align-content: start;
}

.lede {
  color: var(--text-muted);
  max-width: 62ch;
}

/* ---------- home ---------- */

.hero {
  min-width: 0;
  display: grid;
  gap: 0.75rem;
  align-content: center;
}

.hero h1 {
  font-size: clamp(2rem, 1.25rem + 3vw, 3.5rem);
}

.hero .role {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.skills {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

@media (min-width: 36em) {
  .skills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.skill-group {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.4rem;
  align-content: start;
}

.skill-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* featured cards: stacked on phones, one even row from 40em, however many there are */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem 2rem;
}

@media (min-width: 40em) {
  .featured {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }
}

.card {
  min-width: 0;
  display: grid;
  gap: 0.3rem;
  align-content: start;
  border-left: 2px solid var(--accent);
  padding: 0.15rem 0 0.15rem 0.9rem;
  color: var(--text);
  text-decoration: none;
}

.card h3 {
  color: var(--accent);
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card:hover h3 {
  text-decoration: underline;
}

.section-link {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  justify-self: start;
}

/* wide screens: intro on the left, skills on the right, featured work below */
@media (min-width: 64em) {
  .container:has(> .hero) {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(2.5rem, 5vw, 6rem);
  }

  .container:has(> .hero) > .section:has(.featured) {
    grid-column: 1 / -1;
  }
}

/* ---------- portfolio ---------- */

.project {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  align-content: start;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 1.5rem;
}

.project h3 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.project p {
  max-width: 65ch;
}

.project-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tech-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tech-list li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05rem 0.5rem;
}

/* medium screens: section labels in a left column, text beside them */
@media (min-width: 40em) {
  .project {
    grid-template-columns: 9rem minmax(0, 1fr);
    column-gap: 1.5rem;
  }

  .project > h2,
  .project > .project-meta,
  .project > .tech-list {
    grid-column: 1 / -1;
  }

  /* title, then meta, then tech tags, then the labelled sections */
  .project > h2,
  .project > .project-meta {
    order: -2;
  }

  .project > .tech-list {
    order: -1;
    margin-bottom: 0.4rem;
  }

  .project > h3 {
    grid-column: 1;
    margin-top: 0.3rem;
  }

  .project > h3 + p {
    grid-column: 2;
  }
}

/* wide screens: Problem, What I built and Result side by side */
@media (min-width: 72em) {
  .project {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: clamp(2rem, 3vw, 3.5rem);
  }

  .project > h2 { grid-row: 1; }
  .project > .project-meta { grid-row: 2; }
  .project > .tech-list { grid-row: 3; margin-bottom: 0.4rem; }

  .project > h3:nth-of-type(1) { grid-area: 4 / 1; }
  .project > h3:nth-of-type(1) + p { grid-area: 5 / 1; }
  .project > h3:nth-of-type(2) { grid-area: 4 / 2; }
  .project > h3:nth-of-type(2) + p { grid-area: 5 / 2; }
  .project > h3:nth-of-type(3) { grid-area: 4 / 3; }
  .project > h3:nth-of-type(3) + p { grid-area: 5 / 3; }
}

/* ---------- about me ---------- */

.prose {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem clamp(2.5rem, 5vw, 5rem);
}

.prose section {
  min-width: 0;
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.prose p,
.prose li {
  max-width: 65ch;
}

.prose ul {
  margin: 0;
  padding-left: 1.2rem;
}

@media (min-width: 64em) {
  .prose {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- web apps ---------- */

.under-construction {
  display: grid;
  place-items: center;
  min-height: 40vh;
  min-height: 40svh;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
