/* sebweb.css
 * Technical drawing CSS framework for sebastjan's personal website.
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* ─── Tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg:     #f4f4f0;
  --ink:    #1a1a1a;
  --muted:  #666;
  --faint:  #c8c8c4;
  --dot:    rgba(0, 0, 0, 0.12);
  --max-w:  860px;
  --pad:    1.25rem;
  --gap:    1.5rem;
  --font:   'Space Mono', monospace;
}

[data-theme="dark"] {
  --bg:    #0c1824;
  --ink:   #a8c8e8;
  --muted: #5a8aaa;
  --faint: #1e3448;
  --dot:   rgba(100, 160, 210, 0.12);
}

/* ─── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, video, svg { max-width: 100%; display: block; }

/* ─── Base ────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.7;
}

a {
  color: var(--ink);
  font-weight: bold;
}
a:hover { text-decoration-style: solid; }

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-top: 1.75em;
  margin-bottom: 0.4em;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 1em; }

ul { padding-left: 0; }
ul li {
  list-style: none;
  padding-left: 1.5rem;
  position: relative;
}
ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--muted);
}
ol { padding-left: 1.5rem; }
ol li { margin-bottom: 0.25em; }

strong { font-weight: bold; }
em { font-style: italic; }

code {
  font-family: var(--font);
  background: rgba(0,0,0,0.06);
  padding: 0.1em 0.35em;
  font-size: 0.9em;
  border: 1px solid var(--faint);
}
[data-theme="dark"] code { background: rgba(255,255,255,0.05); }

pre {
  font-family: var(--font);
  background: rgba(0,0,0,0.04);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25em;
  border-left: 2px solid var(--ink);
  border: 1px solid var(--faint);
  border-left-width: 2px;
  border-left-color: var(--ink);
}
[data-theme="dark"] pre { background: rgba(255,255,255,0.03); }
pre code { background: none; padding: 0; border: none; font-size: 0.9em; }

blockquote {
  border-left: 2px solid var(--faint);
  padding-left: 1em;
  margin: 1.25em 0;
  color: var(--muted);
}

hr {
  border: none;
  border-bottom: 1px solid var(--faint);
  margin: 2.5rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1.25em;
  display: block;
  overflow-x: auto;
}
table thead { border-bottom: 1px solid var(--ink); }
table td, table th {
  padding: 0.4em 0.75em;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid var(--faint);
}

/* ─── Layout ──────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }

@media (min-width: 540px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 720px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.cluster { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ─── Site nav ────────────────────────────────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1.25rem var(--pad);
  max-width: var(--max-w);
  margin: 0 auto;
  border-bottom: 1px solid var(--faint);
}

.site-nav__brand {
  font-size: 1rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: 0.05em;
}

.site-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav__links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}
.site-nav__links li::before { display: none; }
.site-nav__links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: normal;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.site-nav__links a:hover,
.site-nav__links a[aria-current="page"] {
  color: var(--ink);
  font-weight: bold;
}

/* hamburger hidden on desktop */
#nav-toggle { display: none; }

@media (max-width: 640px) {
  #nav-toggle { display: block; }

  .site-nav__links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--faint);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
  }
  .site-nav__links li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--faint);
  }
  .site-nav__links li:last-child { border-bottom: none; }

  .site-nav--open .site-nav__links {
    display: flex;
  }
}

/* ─── Hero ────────────────────────────────────────────────────────────── */
.hero {
  padding: 5rem var(--pad) 3.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.hero__inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3rem;
}
.hero__text { flex: 1; min-width: 0; }
.hero__portrait {
  flex-shrink: 0;
  width: 160px;
  order: 2;
}
@media (max-width: 600px) {
  .hero__inner { flex-direction: column; gap: 1.5rem; }
  .hero__portrait { width: 100px; order: 0; }
}

.hero__title {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  line-height: 1.1;
  margin-top: 0;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero__sub {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 58ch;
  margin-bottom: 0;
  line-height: 1.75;
}

/* ─── Section ─────────────────────────────────────────────────────────── */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem var(--pad);
}

.section__title {
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--faint);
}

/* ─── Card ────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--faint);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg);
  position: relative;
}
/* corner marks */
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--ink);
  border-style: solid;
}
.card::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.card::after  { top: -1px; right: -1px; border-width: 1px 1px 0 0; }

.card__title {
  font-size: 0.95rem;
  font-weight: bold;
  margin: 0;
}
.card__title a {
  text-decoration: none;
  color: var(--ink);
}
.card__title a:hover { text-decoration: underline; }

.card__desc {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
  flex: 1;
}

.card__meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.card__footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* ─── Tag ─────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1em 0.5em;
  border: 1px solid var(--faint);
  white-space: nowrap;
  text-decoration: none;
  color: var(--muted);
  font-weight: normal;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

/* ─── Box ─────────────────────────────────────────────────────────────── */
.box {
  border: 1px solid var(--ink);
  padding: 1.25rem;
}

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn,
button,
input[type="submit"],
input[type="button"] {
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  padding: 0.4em 1.1em;
  border: 1px solid var(--ink);
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn:hover, button:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .btn:hover,
[data-theme="dark"] button:hover { background: rgba(255,255,255,0.05); }
button:disabled, .btn[aria-disabled="true"] { color: var(--faint); cursor: default; border-color: var(--faint); }

/* ─── Forms ───────────────────────────────────────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="submit"]):not([type="button"]),
textarea,
select {
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--ink);
  background: transparent;
  padding: 0.4em 0.75em;
  border: 1px solid var(--faint);
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); }

fieldset {
  border: 1px solid var(--faint);
  padding: 1rem 1.25rem;
}

label { display: inline-block; padding: 0.2em 0; font-size: 0.88rem; }

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E") no-repeat calc(100% - 0.6em) center / 10px 6px transparent;
}
select[multiple] { background: none; padding: 0; }

input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 1em;
  height: 1em;
  border: 1px solid var(--ink);
  vertical-align: middle;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before {
  content: '';
  width: 0.5em;
  height: 0.5em;
  background: var(--ink);
  border-radius: 1px;
}
input[type="radio"]:checked::before { border-radius: 50%; }

input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 1px dashed var(--ink);
  outline-offset: 2px;
}

/* ─── Prose ───────────────────────────────────────────────────────────── */
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.25em; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 2em; margin-bottom: 0.4em; }
.prose h1:first-child, .prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose img { border: 1px solid var(--faint); margin: 1.5rem 0; }
.prose a { color: var(--ink); }

/* ─── Post header ─────────────────────────────────────────────────────── */
.post-header { margin-bottom: 2.5rem; }
.post-header__date { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; }
.post-header__title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.post-header__desc { color: var(--muted); font-size: 0.95rem; }

/* ─── Back link ───────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--ink); }
.back-link::before { content: "←"; }

/* ─── Site footer ─────────────────────────────────────────────────────── */
.site-footer {
  max-width: var(--max-w);
  margin: 3rem auto 2rem;
  padding: 1.25rem var(--pad) 0;
  border-top: 1px solid var(--faint);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.site-footer a { color: var(--muted); font-weight: normal; }
.site-footer a:hover { color: var(--ink); }

/* ─── Utilities ───────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero { padding: 3rem var(--pad) 2rem; }
  .hero__title { font-size: 1.6rem; }
  .section { padding: 2rem var(--pad); }
}
