/* gavriliu.net — engineering-drawing vernacular.
   Devices: dimension rules (the labelled divider is the heading) and a
   title-block footer. Palette from fibre-optic connector coding: aqua on
   graphite and cool grey. */

:root {
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;

  --paper: #e9ece6;
  --paper-raised: #f3f5f0;
  --ink: #16181b;
  --muted: #5a615a;
  --rule: #c1c8bd;
  --accent: #0c7f74;
  --accent-quiet: #0c7f7414;

  --measure: 34rem;
  --gutter: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121417;
    --paper-raised: #191c20;
    --ink: #e3e6e0;
    --muted: #949c94;
    --rule: #2f3532;
    --accent: #57cfc2;
    --accent-quiet: #57cfc21f;
  }
}

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

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

body {
  margin: 0;
  padding: 0 var(--gutter);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-synthesis: none;
}

.sheet {
  max-width: 46rem;
  margin: 0 auto;
}

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

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

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

/* ---- masthead ---------------------------------------------------------- */

.masthead { padding: 4.5rem 0 0; }

/* Dimension line above the name: a drawn measure of the sheet width. */
.measure-rule {
  position: relative;
  height: 11px;
  margin-bottom: 2.25rem;
}

.measure-rule::before {
  content: "";
  position: absolute;
  inset: 5px 0;
  border-top: 1px solid var(--rule);
  transform-origin: left center;
  animation: draw 620ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.measure-rule__tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 11px;
  background: var(--rule);
}

.measure-rule__tick--start { left: 0; }
.measure-rule__tick--end { right: 0; }

@keyframes draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.masthead__name {
  display: inline-block;
  margin: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(2rem, 6.5vw, 3.1rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink);
  text-decoration: none;
}

a.masthead__name:hover { color: var(--accent); }

.masthead__lead {
  max-width: var(--measure);
  margin: 0;
  font-size: 1.15rem;
}

.masthead__nav {
  margin-top: 2rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead__nav a {
  margin-right: 1.5rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.masthead__nav a:hover { border-bottom-color: var(--accent); }

main { margin-top: 2.25rem; }

/* ---- dimension rule: the divider carries the section name --------------- */

.dim {
  position: relative;
  margin: 4rem 0 1.75rem;
  border: 0;
  border-top: 1px solid var(--rule);
  height: 0;
  font-size: inherit;
  font-weight: inherit;
}

.dim::before,
.dim::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 1px;
  height: 11px;
  background: var(--rule);
}

.dim::before { left: 0; }
.dim::after { right: 0; }

.dim__label {
  position: absolute;
  top: -0.78em;
  left: 0;
  padding-right: 0.85rem;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- entries ----------------------------------------------------------- */

.entry {
  margin: 0 0 2.25rem;
  max-width: var(--measure);
}

.entry__name {
  margin: 0;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.entry__note {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

/* ---- post list --------------------------------------------------------- */

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

.posts li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.posts li:last-child { border-bottom: 0; }

.posts a {
  flex: 1 1 18rem;
  text-decoration: none;
}

.posts a:hover { text-decoration: underline; }

time {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---- prose ------------------------------------------------------------- */

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

.prose h1 {
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.prose h2 {
  margin: 2.5rem 0 0.6rem;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.prose p { margin: 0 0 1.15rem; }

.prose > time {
  display: block;
  margin-bottom: 2rem;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--accent-quiet);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  font-size: 0.86rem;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

/* ---- title block ------------------------------------------------------- */

.titleblock {
  margin: 5rem 0 3rem;
  border: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  font-family: var(--mono);
}

.titleblock__cell {
  padding: 0.7rem 0.9rem;
  border-right: 1px solid var(--rule);
}

.titleblock__cell:last-child { border-right: 0; }

.titleblock__key {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.titleblock__val {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.titleblock a { text-decoration: none; }
.titleblock a:hover { text-decoration: underline; }

@media (max-width: 34rem) {
  .titleblock { grid-template-columns: 1fr; }

  .titleblock__cell {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .titleblock__cell:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .measure-rule::before { animation: none; }
}
