/* ===========================
   Custom Properties
   =========================== */

:root {
  /* Fonts */
  --font-sans: "Instrument Sans", "Inter", system-ui, -apple-system, sans-serif;
  --font-serif: "Libre Baskerville", "Georgia", "Times New Roman", serif;

  /* Type Scale */
  --text-nav: 0.875rem;
  --text-body: 1.1875rem;
  --text-heading: 1.75rem;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --space-xl: 5rem;

  /* Layout */
  --content-width: 680px;
  --nav-height: 3.5rem;

  /* Light Mode Colors (default) */
  --bg: #faf9f5;

  --bg-subtle: #f0efe8;
  --text: #1a1a18;
  --text-muted: #6b6963;
  --accent: #9b8b78;
  --accent-hover: #7a6b5a;
  --border: #e0ded6;
  --selection: #e8d5c4;
}

/* ===========================
   Dark Mode
   =========================== */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;

    --bg-subtle: #1e1e1c;
    --text: #e8e6dc;
    --text-muted: #8a8880;
    --accent: #c4a882;
    --accent-hover: #d4bc9a;
    --border: #2a2a28;
    --selection: #3d3529;
  }
}

/* ===========================
   View Transitions
   =========================== */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.2s;
  animation-timing-function: ease-in-out;
}

/* ===========================
   Reset & Base
   =========================== */

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

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

body {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--selection);
  color: var(--text);
}

img {
  max-width: 100%;
  display: block;
}

/* ===========================
   Links
   =========================== */

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

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

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

/* ===========================
   Layout
   =========================== */

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

@media (min-width: 768px) {
  .content-wrapper {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* ===========================
   Header & Navigation
   =========================== */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
}

.header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2rem;
  translate: 0 100%;
  background: linear-gradient(to bottom, var(--bg), transparent);
  pointer-events: none;
}

.nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  height: var(--nav-height);
  padding-top: 1rem;
}

.nav-name {
  font-family: var(--font-sans);
  font-size: var(--text-nav);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.nav-name:hover {
  color: var(--text);
}

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

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-nav);
}

.nav-separator {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-nav);
  user-select: none;
  margin: 0 0.375rem;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: var(--text-nav);
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--text);
}

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

/* ===========================
   Main Content
   =========================== */

.main {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
  min-height: calc(100vh - var(--nav-height));
  min-height: calc(100dvh - var(--nav-height));
}

/* ===========================
   Font Loading
   =========================== */

.fonts-loading .main {
  opacity: 0;
}

.fonts-loaded .main {
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* ===========================
   Hero (Home)
   =========================== */

.hero p {
  text-wrap: pretty;
  margin-bottom: var(--space-md);
}

.hero p:last-child {
  margin-bottom: 0;
}

/* ===========================
   Writing Index
   =========================== */

.writing-list {
  list-style: none;
}

.writing-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.writing-item:first-child {
  border-top: 1px solid var(--border);
}

.writing-item a {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.writing-item time {
  font-family: var(--font-sans);
  font-size: var(--text-nav);
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: var(--space-md);
}

/* ===========================
   Article
   =========================== */

.article-header {
  margin-bottom: var(--space-lg);
}

.article-title {
  font-family: var(--font-serif);
  font-size: var(--text-heading);
  font-weight: normal;
  line-height: 1.3;
  color: var(--text);
}

.article-date {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--text-nav);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.article-body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
}

.article-body p {
  margin-bottom: var(--space-md);
}

.article-body h2 {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-md);
}

.article-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: var(--space-md);
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.article-body blockquote p {
  margin-bottom: 0;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: var(--space-md);
}

.article-body li {
  margin-bottom: var(--space-xs);
}

/* ===========================
   Contact Line (Home)
   =========================== */

.contact-line {
  margin-top: var(--space-lg);
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

