/* ---------------------------------------------------------------
   Scribbleshort — base stylesheet, loaded on every page.
   Same palette/chrome as the desktop homepage (src/css/desktop.css)
   so navigating from a window into a real page doesn't feel like a
   different site. Body copy stays serif or readability; nav/meta/
   labels use the monospace "OS chrome" font, same as window content.
   No web fonts, no framework.
   ----------------------------------------------------------------*/

:root {
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --content-width: 42rem;
  --wide-width: 56rem;
}

[data-theme="light"] {
  --bg: #e7e0cf;
  --dot: #d3c9ac;
  --panel: #f7f4ea;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #c1633d;
  --border: #1a1a1a;
  --border-soft: #cfc6ac;
}

[data-theme="dark"] {
  --bg: #15130f;
  --dot: #26221b;
  --panel: #201c17;
  --text: #eeeae2;
  --muted: #a89c89;
  --accent: #e2854f;
  --border: #eeeae2;
  --border-soft: #35302a;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

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

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap--wide {
  max-width: var(--wide-width);
}

.site-header {
  padding: 1.75rem 0;
  background: var(--panel);
  border-bottom: 1.5px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.site-title {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

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

.site-nav {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

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

/* Works dropdown — pure CSS, no JS. Opens on hover (mouse) or
   focus-within (keyboard tabbing into the trigger link); on touch
   devices with no hover, tapping the trigger just navigates to /works/,
   which lists the same four categories as plain links. */
.nav-dropdown {
  position: relative;
  /* Extends the hoverable box down to meet the menu below, so moving the
     mouse from the trigger to the menu doesn't cross a dead zone that
     isn't part of any hovered element (which would drop :hover and close
     the menu mid-move). The negative margin cancels the padding's effect
     on layout/alignment, so nothing shifts visually. */
  padding-bottom: 0.75rem;
  margin-bottom: -0.75rem;
}

.nav-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--panel);
  border: 1.5px solid var(--border);
  padding: 0.9rem 1.1rem;
  min-width: 9rem;
  z-index: 20;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu {
  display: flex;
}

.nav-dropdown__menu a {
  white-space: nowrap;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--panel);
}

/* Sticky footer: .static-fallback (header + main + footer) is the flex
   column so short pages still pin the footer to the bottom of the
   viewport instead of leaving it floating right under the content. */
.static-fallback {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
  padding: 5rem 0 5rem;
}

.site-footer {
  border-top: 1.5px solid var(--border);
  background: var(--panel);
  padding: 1.5rem 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

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

.site-footer__links {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.25;
  margin: 2.2em 0 0.6em;
}

h1 { font-size: 2.1rem; margin-top: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p, ul, ol, blockquote, figure {
  margin: 0 0 1.3em;
}

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

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

blockquote {
  margin-left: 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--border-soft);
  color: var(--muted);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1.5px solid var(--border);
  margin: 3rem 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1.5px solid var(--border);
}

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

pre {
  background: var(--panel);
  border: 1.5px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
}

/* ---------- Meta / labels ---------- */

.meta {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

/* ---------- Lists of entries (posts, projects, works) ---------- */

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

.entry-list li {
  padding: 1.4rem 0;
  border-bottom: 1.5px solid var(--border-soft);
}

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

.entry-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  margin: 0 0 0.3rem;
}

.entry-title a {
  color: var(--text);
  text-decoration: none;
}

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

.entry-excerpt {
  color: var(--muted);
  margin: 0.4rem 0 0;
  font-size: 1rem;
}

/* ---------- Homepage sections (used by the static fallback) ---------- */

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3.5rem 0 1rem;
}

.section-heading:first-of-type {
  margin-top: 0;
}

.section-heading a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border-soft);
}

.intro {
  font-size: 1.2rem;
  color: var(--text);
}

/* ---------- Chapters (long-form projects) ---------- */

.chapter-toc {
  font-family: var(--mono);
  font-size: 0.9rem;
  border: 1.5px solid var(--border);
  background: var(--panel);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0 3rem;
}

.chapter-toc p {
  margin: 0 0 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.chapter-toc ol {
  margin: 0;
  padding-left: 1.2rem;
}

.chapter {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1.5px solid var(--border-soft);
}

.chapter:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ---------- Contact form (Netlify Forms) ---------- */

.contact-form {
  margin-top: 2.5rem;
  max-width: 32rem;
}

.form-row {
  margin-bottom: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row label {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.form-row input,
.form-row textarea {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text);
  background: var(--panel);
  border: 1.5px solid var(--border);
  padding: 0.6rem 0.7rem;
  width: 100%;
  box-sizing: border-box;
}

.form-row textarea {
  resize: vertical;
  font-family: var(--serif);
  line-height: 1.5;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.contact-form .btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--panel);
  background: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 0.65rem 1.4rem;
  cursor: pointer;
}

.contact-form .btn:hover {
  background: var(--text);
  border-color: var(--text);
}

/* ---------- Maintenance mode ---------- */

.maintenance {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
}

.maintenance .wrap {
  max-width: var(--content-width);
}

.maintenance .site-title {
  margin-bottom: 1rem;
}

/* ---------- Utility ---------- */

.center {
  text-align: center;
}

.mt-0 { margin-top: 0; }

@media (max-width: 40rem) {
  body { font-size: 1.05rem; }
  main { padding: 2rem 0 4rem; }
}
