/* ============================================================================
   mpitsiali.com

   Two voices, held apart on purpose:
     - the interface speaks in JetBrains Mono (dates, tags, nav, controls)
     - the writing speaks in Literata (titles, prose)
   Chrome is a terminal. Writing is a page.

   Accent is copper, because Cyprus is where copper gets its name, and patina
   is what copper becomes when it is left alone for a while.
   ========================================================================== */

:root {
  --bg: #131417;
  --surface: #1b1d21;
  --text: #e8e6e1;
  --text-dim: #9a9ca3;
  --text-faint: #6e7077;
  --rule: #262930;
  --copper: #d0873f;
  --copper-hi: #e39b52;
  --patina: #5fa894;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Literata", Georgia, "Times New Roman", serif;

  --measure: 66ch;
  --step: 0.25rem;
}

[data-theme="light"] {
  --bg: #fbfaf8;
  --surface: #f2f0ec;
  --text: #1a1b1e;
  --text-dim: #5e6169;
  --text-faint: #8a8d94;
  --rule: #e3e0da;
  --copper: #a45e20;
  --copper-hi: #8a4d18;
  --patina: #2f7666;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}

/* Everything that is interface, not writing. */
.mono,
.site-nav,
.log-date,
.log-time,
.log-tags,
.filters,
.pagination,
.post-meta,
.post-nav,
.back-link,
.site-footer,
.empty {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  font-variant-ligatures: none;
}

.container {
  max-width: 58rem;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-wide {
  max-width: 62rem;
}

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

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 3.5rem 0 1rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--copper);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-faint);
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.site-nav a:hover {
  color: var(--copper);
  border-bottom-color: var(--copper);
}

.nav-sep {
  color: var(--rule);
  user-select: none;
}

/* A disc of copper that oxidises to hollow patina in the light. No emoji. */
.theme-toggle {
  width: 0.85rem;
  height: 0.85rem;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--copper);
  background: var(--copper);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

[data-theme="light"] .theme-toggle {
  background: transparent;
  border-color: var(--patina);
}

.theme-toggle:hover {
  transform: scale(1.2);
}

.tagline {
  color: var(--text-dim);
  font-size: 1.0625rem;
  font-style: italic;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

/* ----------------------------------------------------------------- filters */

.filters {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.75rem 0 0.75rem;
}

.filters-label {
  color: var(--text-faint);
}

.tag-btn {
  background: none;
  border: none;
  font: inherit;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tag-btn:hover {
  color: var(--copper);
}

.tag-btn.active {
  color: var(--copper);
  border-bottom-color: var(--copper);
}

/* --------------------------------------------------------------------- log */

.log {
  border-top: 1px solid var(--rule);
  margin: 0 -1rem;
}

.log-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto 4rem;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.15rem 1rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background 0.15s ease;
}

/* The copper rule that runs down a selected row, like a cursor in a terminal. */
.log-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: var(--copper);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.18s ease;
}

.log-row:hover {
  background: var(--surface);
}

.log-row:hover::before,
.log-row:focus-visible::before {
  transform: scaleY(1);
}

.log-date {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* The title is the only thing on this row set in the reading face: the writing
   surfacing out of the machinery around it. */
.log-title {
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
  text-transform: none;
}

.log-row:hover .log-title {
  color: var(--copper);
}

.log-excerpt {
  display: block;
  font-family: var(--serif);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin-top: 0.3rem;
  text-transform: none;
}

.log-tags {
  color: var(--text-faint);
  white-space: nowrap;
}

.log-time {
  color: var(--text-faint);
  text-align: right;
  white-space: nowrap;
}

.empty {
  padding: 4rem 0;
  color: var(--text-dim);
  border-bottom: 1px solid var(--rule);
}

/* -------------------------------------------------------------- pagination */

.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 0;
  color: var(--text-faint);
}

.pagination:empty {
  display: none;
}

.pagination-btn {
  background: none;
  border: none;
  font: inherit;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  border-bottom: 1px solid transparent;
}

.pagination-btn:hover:not(:disabled) {
  color: var(--copper);
}

.pagination-btn.active {
  color: var(--copper);
  border-bottom-color: var(--copper);
}

.pagination-btn:disabled {
  color: var(--rule);
  cursor: default;
}

.pagination-count {
  margin-left: auto;
}

/* --------------------------------------------------------------- post page */

.back-link {
  display: inline-block;
  margin: 2.5rem 0 3rem;
  color: var(--text-dim);
  text-decoration: none;
}

.back-link:hover {
  color: var(--copper);
}

.post-layout {
  display: grid;
  gap: 2rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--text-faint);
}

.post-meta a {
  color: var(--text-dim);
  text-decoration: none;
}

.post-meta a:hover {
  color: var(--copper);
}

.post-title {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 1.75rem;
}

/* Wide enough for the metadata to leave the flow and sit in the margin, the
   way a note sits beside a manuscript. */
@media (min-width: 62rem) {
  .post-layout {
    grid-template-columns: 9rem minmax(0, var(--measure));
    gap: 3.5rem;
  }

  .post-aside {
    grid-column: 1;
    position: sticky;
    top: 2.5rem;
    align-self: start;
  }

  .post-meta {
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 0.4rem;
  }

  .meta-sep {
    display: none;
  }

  .post-body {
    grid-column: 2;
  }
}

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

.prose {
  max-width: var(--measure);
  font-size: 1.125rem;
  line-height: 1.75;
}

.prose > * + * {
  margin-top: 1.5rem;
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-top: 3rem;
}

.prose h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  margin-top: 2.25rem;
}

.prose a {
  color: var(--copper);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--copper-hi);
}

.prose a:visited {
  color: var(--patina);
}

.prose strong {
  font-weight: 700;
}

.prose blockquote {
  border-left: 2px solid var(--copper);
  padding-left: 1.5rem;
  color: var(--text-dim);
  font-style: italic;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

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

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  color: var(--copper);
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}

.prose img,
.prose video {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.prose th {
  background: var(--surface);
  font-weight: 600;
}

/* ---------------------------------------------------------------- post nav */

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 5rem;
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text-dim);
  transition: background 0.15s ease;
}

.post-nav-link:hover {
  background: var(--surface);
}

.post-nav-next {
  text-align: right;
}

.post-nav-label {
  color: var(--text-faint);
}

.post-nav-title {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
}

.post-nav-link:hover .post-nav-title {
  color: var(--copper);
}

/* ------------------------------------------------------------------ footer */

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-faint);
  padding: 4rem 0 3rem;
  margin-top: 5rem;
  border-top: 1px solid var(--rule);
}

.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--copper);
}

/* --------------------------------------------------------------------- 404 */

.notfound {
  padding: 8rem 0;
}

.notfound-code {
  font-family: var(--mono);
  font-size: 4rem;
  font-weight: 600;
  color: var(--copper);
  line-height: 1;
}

.notfound-msg {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--text-dim);
  margin: 1rem 0 2rem;
}

/* ------------------------------------------------------- state and motion */

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- narrow */

@media (max-width: 46rem) {
  .container {
    padding: 0 1.25rem;
  }

  .log {
    margin: 0 -0.75rem;
  }

  .masthead {
    padding-top: 2.5rem;
  }

  /* The log stops being a table and becomes a stack; date and reading time
     ride together on one line above the title. */
  .log-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 1.25rem 0.75rem;
  }

  .log-tags {
    text-align: left;
    white-space: normal;
  }

  /* Reading time is on the post itself; four stacked metadata lines per row
     is more bookkeeping than a phone screen needs. */
  .log-time {
    display: none;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav-next {
    text-align: left;
  }
}
