/*
  dsugurtuna.github.io
  One stylesheet. No build step, no web fonts, no framework.
  Colours are custom properties so light and dark mode share every rule.
*/

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --bg: #fbfaf7;
  --bg-raised: #f3f1eb;
  --text: #1c1b18;
  --muted: #5c5950;
  --rule: #e3dfd6;
  --accent: #0d6b5b;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --font-serif: "Iowan Old Style", Charter, "Bitstream Charter", "Sitka Text",
    Cambria, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --step--2: 0.8125rem;
  --step--1: 0.9rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.45rem, 1.25rem + 0.8vw, 1.8rem);
  --step-3: clamp(1.9rem, 1.4rem + 2vw, 2.75rem);
  --step-4: clamp(2.2rem, 1.5rem + 3.2vw, 3.9rem);

  --gutter: clamp(1rem, 0.4rem + 3vw, 2.5rem);
  --wide: 68rem;
  --measure: 40rem;
  --section-space: clamp(3rem, 2rem + 4vw, 5.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141513;
    --bg-raised: #1c1d1a;
    --text: #ebe8e1;
    --muted: #a9a59b;
    --rule: #30312d;
    --accent: #6fcbb3;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-kerning: normal;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

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

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

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

svg {
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
}

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

.site-header {
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding-block: 0.25rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
}

.brand-mark rect {
  fill: var(--accent);
}

.brand-mark path {
  stroke: var(--bg);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.35rem;
  color: var(--muted);
  font-size: 0.975rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

/* ---------- Shared type ---------- */

.eyebrow {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.eyebrow a {
  color: inherit;
}

.lede {
  max-width: 38rem;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.55;
}

.more {
  margin-top: 2rem;
  font-weight: 600;
}

/* ---------- Home: hero ---------- */

.hero {
  padding-block: clamp(3.5rem, 2rem + 6vw, 7.5rem) var(--section-space);
}

.hero h1 {
  max-width: 21ch;
  font-size: var(--step-4);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero .lede {
  margin-top: 1.75rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  font-weight: 600;
}

.hero-links a {
  display: inline-block;
  padding-block: 0.2rem;
}

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

.section {
  border-top: 1px solid var(--rule);
  padding-block: var(--section-space);
}

.section-grid {
  display: grid;
  gap: 1.5rem 3rem;
}

.section-head h2 {
  font-size: var(--step-2);
}

.section-head p {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: var(--step--1);
}

@media (min-width: 54rem) {
  .section-grid {
    grid-template-columns: 14rem minmax(0, 1fr);
  }

  .section-head {
    position: sticky;
    top: 2rem;
    align-self: start;
  }
}

/* Now / Before / The thread */

.story {
  display: grid;
  gap: 2rem;
  max-width: var(--measure);
  margin: 0;
}

.story dt {
  margin-bottom: 0.4rem;
  color: var(--accent);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.story dd {
  margin: 0;
}

/* Flagship projects */

.flagships {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: flagship;
}

.flagship {
  counter-increment: flagship;
  padding-block: 1.75rem;
  border-top: 1px solid var(--rule);
}

.flagship:first-child {
  padding-top: 0;
  border-top: 0;
}

.flagship-label {
  margin-bottom: 0.6rem;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.flagship-label::before {
  content: "0" counter(flagship) "\2002";
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.flagship .question {
  max-width: 36rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-serif);
  font-size: var(--step-1);
  line-height: 1.45;
}

.flagship-repo a {
  margin-right: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.975rem;
  font-weight: 600;
}

.built-with {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: var(--step--1);
}

/* Principles */

.principles {
  display: grid;
  gap: 1.75rem 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .principles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.principles li {
  padding-top: 1rem;
  border-top: 2px solid var(--text);
}

.principles h3 {
  margin-bottom: 0.4rem;
  font-size: var(--step-1);
}

.principles p {
  color: var(--muted);
}

/* Track record */

.record {
  max-width: var(--measure);
  margin: 0;
  padding: 0;
  list-style: none;
}

.record li {
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--rule);
}

.record li:first-child {
  border-top: 1px solid var(--rule);
}

.record strong {
  font-variant-numeric: tabular-nums;
}

.record-intro {
  margin-bottom: 1.25rem;
}

/* Essay list (home and writing index) */

.essay-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.essay-list li {
  padding-block: 1.5rem;
  border-top: 1px solid var(--rule);
}

.essay-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.essay-list h2,
.essay-list h3 {
  margin-bottom: 0.5rem;
  font-size: var(--step-1);
  line-height: 1.3;
}

.essay-list h2 a,
.essay-list h3 a {
  color: var(--text);
  text-decoration-color: var(--rule);
}

.essay-list h2 a:hover,
.essay-list h3 a:hover {
  text-decoration-color: var(--accent);
}

.essay-list p {
  max-width: 38rem;
  color: var(--muted);
}

.essay-meta {
  margin-top: 0.5rem;
  font-size: var(--step--1);
}

/* Contact */

.contact {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.contact div {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
}

.contact dt {
  min-width: 5rem;
  color: var(--muted);
}

.contact dd {
  margin: 0;
  font-weight: 600;
}

/* ---------- Inner pages ---------- */

.page-head {
  padding-block: clamp(3rem, 2rem + 4vw, 5.5rem) var(--section-space);
}

.page-head h1 {
  max-width: 28ch;
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.page-head .lede {
  margin-top: 1.25rem;
}

/* Projects */

.group-intro {
  max-width: var(--measure);
  margin-bottom: 2rem;
  color: var(--muted);
}

.area + .area {
  margin-top: 2.5rem;
}

.area > h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.repos {
  display: grid;
  gap: 1.75rem 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 44rem) {
  .repos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.repo-name {
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.975rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.repo-question {
  margin-bottom: 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.45;
}

.repo-stage {
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.repo-desc {
  margin-bottom: 0.65rem;
}

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

.tags li {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
}

.standards {
  max-width: var(--measure);
  margin: 0;
  padding-left: 1.2rem;
}

.standards li + li {
  margin-top: 0.6rem;
}

.standards li::marker {
  color: var(--accent);
}

/* ---------- Essays ---------- */

/* One centred reading column: about 70 characters a line at body size. */
.essay {
  max-width: calc(40rem + 2 * var(--gutter));
}

.essay-head {
  padding-block: clamp(3rem, 2rem + 4vw, 5rem) 2.5rem;
}

.essay-head h1 {
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.dek {
  margin-top: 1.25rem;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: var(--step-1);
  font-style: italic;
  line-height: 1.5;
}

.byline {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: var(--step--1);
}

.prose {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.7;
}

@media (min-width: 40rem) {
  .prose {
    font-size: 1.1875rem;
  }
}

.prose h2 {
  margin: 2.25em 0 0.6em;
  font-size: 1.35rem;
  line-height: 1.3;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.1em;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li::marker {
  color: var(--accent);
}

.essay-foot {
  margin-top: 3.5rem;
  padding-bottom: var(--section-space);
}

.sources {
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: var(--step--1);
}

.sources h2,
.related h2 {
  margin-bottom: 0.75rem;
  font-family: var(--font-sans);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sources h2 {
  color: var(--muted);
}

.sources ol {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.sources li + li {
  margin-top: 0.5rem;
}

.related {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border-radius: 4px;
  background: var(--bg-raised);
}

.related h2 {
  color: var(--accent);
}

.related .repo-link {
  margin-top: 1rem;
  font-weight: 600;
}

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

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 2.5rem 3rem;
  color: var(--muted);
  font-size: var(--step--1);
}

.site-footer .disclaimer {
  margin-bottom: 0.75rem;
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding-block: 0.2rem;
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  a {
    color: inherit;
  }
}
