/* ===========================================================================
   Homestead — a hand-built personal site.
   Warm paper in the day, warm dark at night. Serif for reading, monospace for
   the little structural bits (nav, dates, labels). No frameworks, no web fonts.
   =========================================================================== */

:root {
  /* Light: warm paper */
  --bg: #faf6ef;
  --bg-sunk: #f3ecdf; /* form fields, faint panels */
  --text: #2b2722;
  --muted: #6b6358;
  --rule: #e3dccd;
  --accent: #a8431f; /* rust */
  --accent-soft: #c8602f; /* hover */

  --serif: Georgia, "Iowan Old Style", Palatino, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

  --measure: 40rem; /* reading column */
  --step: 1rem; /* base spacing unit */
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark: warm hearth */
    --bg: #1b1916;
    --bg-sunk: #232019;
    --text: #e8e1d4;
    --muted: #9a9082;
    --rule: #34302a;
    --accent: #e0935a; /* warm amber, reads on dark */
    --accent-soft: #f0a868;
  }
}

/* --- base ----------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem; /* ~18px */
  line-height: 1.65;
  /* breathing room so content never kisses the viewport edge on mobile */
  padding: calc(var(--step) * 2) var(--step);
}

main {
  max-width: var(--measure);
  margin: 0 auto;
}

/* --- links ---------------------------------------------------------------- */

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

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

/* --- headings ------------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.2;
  font-weight: 600;
  margin: calc(var(--step) * 1.6) 0 var(--step);
}

h1 {
  font-size: 1.9rem;
}
h2 {
  font-size: 1.4rem;
}
h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 var(--step);
}

/* --- the small structural bits, set in monospace -------------------------- */

.site-nav,
.post-meta,
.feed-link,
time,
small,
label,
footer {
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* the small "rss" link under a list page's heading */
.feed-link {
  color: var(--muted);
  margin: calc(var(--step) * -0.5) 0 calc(var(--step) * 1.5);
}

.feed-link a {
  color: var(--muted);
  text-underline-offset: 0.15em;
}

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

/* --- header / nav --------------------------------------------------------- */

.site-header {
  max-width: var(--measure);
  margin: 0 auto calc(var(--step) * 2);
}

.site-title {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 calc(var(--step) * 0.4);
}

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

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

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

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

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

/* current page: marked, not loud */
.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* the · separators between nav items */
.site-nav .sep {
  color: var(--rule);
  margin: 0 0.5ch;
}

/* --- rules / dividers ----------------------------------------------------- */

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: calc(var(--step) * 2) 0;
}

/* --- posts ---------------------------------------------------------------- */

article {
  margin: 0 0 calc(var(--step) * 2);
}

article h2 {
  margin-top: 0;
}

.post-meta {
  color: var(--muted);
  margin: calc(var(--step) * 0.4) 0 0;
}

.post-meta a {
  color: var(--muted);
  text-underline-offset: 0.15em;
}

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

/* keep markdown media tidy inside posts */
article img {
  max-width: 100%;
  height: auto;
}

blockquote {
  margin: var(--step) 0;
  padding-left: var(--step);
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

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

pre {
  background: var(--bg-sunk);
  padding: var(--step);
  overflow-x: auto;
  border-radius: 2px;
}

/* --- forms ---------------------------------------------------------------- */

label {
  color: var(--muted);
  display: inline-block;
  margin-bottom: 0.3em;
}

input,
textarea,
button {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text);
}

input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.5em 0.6em;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

small {
  display: inline-block;
  color: var(--muted);
  margin-top: 0.3em;
}

button {
  font-family: var(--mono);
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.5em 1em;
}

button:hover {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

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

footer {
  max-width: var(--measure);
  margin: calc(var(--step) * 3) auto 0;
  padding-top: var(--step);
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

.footer-mark {
  letter-spacing: 0.6ch;
  color: var(--rule);
}

/* the site-wide profile links, sitting under the page links */
.footer-social {
  margin-top: calc(var(--step) * 0.4);
}

.footer-social a {
  color: var(--muted);
  text-decoration: none;
}

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

.footer-social .sep {
  color: var(--rule);
  margin: 0 0.5ch;
}

/* --- contact card --------------------------------------------------------- */

/* h-card profile header on the contact page: centered photo, name, location */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: var(--step) 0 calc(var(--step) * 2);
  padding-bottom: calc(var(--step) * 1.5);
  border-bottom: 1px solid var(--rule);
}

.profile-header .u-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 0 var(--step);
}

.profile-name {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.profile-location {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.2em 0 0;
}

.profile-note {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 32ch;
  margin: var(--step) 0 0;
}

/* --- contact links -------------------------------------------------------- */

/* "find me here" list on the contact page: tidy, mono, no bullets */
.contact-links {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--step);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.contact-links li {
  margin: 0 0 0.3em;
}

/* --- analytics dashboard -------------------------------------------------- */

/* window switcher (7d · 30d · 90d) and the headline totals, set in mono */
.stats-windows,
.stats-summary {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.stats-windows a {
  color: var(--muted);
  text-decoration: none;
}

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

.stats-windows .sep {
  color: var(--rule);
  margin: 0 0.5ch;
}

.stats-empty {
  color: var(--muted);
}

/* compact, rule-lined tables for the top-pages / referrers / by-day rollups */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.8rem;
  margin: 0 0 calc(var(--step) * 2);
}

.stats-table th,
.stats-table td {
  text-align: left;
  padding: 0.4em 0.6em;
  border-bottom: 1px solid var(--rule);
}

.stats-table th {
  color: var(--muted);
  font-weight: 600;
}

/* numeric columns (everything after the first) sit right-aligned */
.stats-table th:not(:first-child),
.stats-table td:not(:first-child) {
  text-align: right;
  width: 6ch;
  white-space: nowrap;
}

.stats-table td a {
  color: var(--accent);
  text-decoration: none;
}

.stats-table td a:hover {
  text-decoration: underline;
}
