/* 1. Fonts, colors, and themes */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/InterVariable.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  --color-background: #000000;
  --color-foreground: #ffffff;
  --color-dim: #8a8a8a;
  --color-body: #a8a8a8;
  --color-line: #262626;
  --color-line-strong: #333333;
  --color-focus: #ffffff;
  --color-switch-sun: #3a3a3a;
  --color-switch-moon: #000000;
  --color-section-notes: oklch(0.74 0.19 250);
  --color-section-photos: oklch(0.80 0.19 145);
  --color-section-projects: oklch(0.82 0.18 92);
  --color-section-things: oklch(0.72 0.22 330);
  --section-accent: var(--color-foreground);
  --space-page-start: clamp(40px, 5vw, 56px);
  --space-page-end: clamp(48px, 6vw, 72px);

  --font-sans:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  --font-display: var(--font-sans);
}

html[data-theme="light"] {
  color-scheme: light;

  --color-background: #f4f2ed;
  --color-foreground: #141312;
  --color-dim: #6b6b6b;
  --color-body: #55534e;
  --color-line: #dcd8d0;
  --color-line-strong: #c9c5bc;
  --color-focus: #141312;
  --color-switch-sun: #f4f2ed;
  --color-switch-moon: #b5b1a8;
}

html[data-section="notes"] {
  --section-accent: var(--color-section-notes);
}

html[data-section="photos"] {
  --section-accent: var(--color-section-photos);
}

html[data-section="projects"] {
  --section-accent: var(--color-section-projects);
}

html[data-section="things"] {
  --section-accent: var(--color-section-things);
}

/* 2. Base styles and shared page layout */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scrollbar-gutter: stable;
  background: var(--color-background);
}

body {
  margin: 0;
  min-height: 100vh;

  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 4px;
}

.site-shell {
  width: min(1100px, calc(100% - 48px));

  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 28px;
  color: var(--color-foreground);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-decoration: none;
}

h1 {
  margin: 0;

  font-family: var(--font-display);
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.055em;
}

.intro {
  max-width: 520px;

  margin: 40px 0 0;

  color: var(--color-body);

  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.6;
}

.hero,
.notes-page,
.note,
.photos-page,
.projects-page,
.things-page {
  padding-block:
    var(--space-page-start)
    var(--space-page-end);
}

.page-header,
.note-header {
  max-width: 760px;
}

.notes-page h1,
.note h1,
.photos-page h1,
.projects-page h1,
.things-page h1 {
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.95;
}

html[data-section="notes"] .notes-page h1,
html[data-section="photos"] .photos-page h1,
html[data-section="projects"] .projects-page h1,
html[data-section="things"] .things-page h1 {
  color: var(--section-accent);
  font-weight: 800;
}

.page-header .intro {
  margin-top: 18px;
}

/* Shared text defaults — individual notes override these below. */

.note-list p,
.note-summary,
.prose {
  color: var(--color-body);
  line-height: 1.7;
}

.note-list p,
.note-summary {
  margin: 0;
}

.note-list-date,
.note-header time {
  color: var(--section-accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag,
.project-status,
.thing-meta {
  margin: 0;
  color: var(--color-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html[data-section="projects"] .project-card .tag,
html[data-section="things"] .thing-meta {
  color: var(--section-accent);
}

.project-card h2,
.thing h2 {
  margin: 18px 0 14px;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.project-summary,
.thing-description {
  margin: 0;
  color: var(--color-body);
  line-height: 1.65;
}

/* 3. Shared header, navigation, footer, and theme switch */

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header {
  min-height: 64px;
}

.wordmark {
  margin: 0;
  color: var(--color-foreground);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-decoration: none;
}

.site-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 22px;
}

.site-navigation a {
  color: var(--color-foreground);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid var(--color-line-strong);
  padding-bottom: 1px;
}

.site-navigation a[data-nav-section="notes"]:hover {
  color: var(--color-section-notes);
}

.site-navigation a[data-nav-section="photos"]:hover {
  color: var(--color-section-photos);
}

.site-navigation a[data-nav-section="projects"]:hover {
  color: var(--color-section-projects);
}

.site-navigation a[data-nav-section="things"]:hover {
  color: var(--color-section-things);
}

.site-navigation a[aria-current="page"] {
  border-color: var(--section-accent);
}

.site-footer {
  min-height: 56px;
  border-top: 1px solid var(--color-line);
}

.site-footer p {
  margin: 0;
  color: var(--color-foreground);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.theme-switch {
  position: relative;
  width: 52px;
  height: 24px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--color-foreground);
  border-radius: 12px;
  background: transparent;
  color: var(--color-foreground);
  cursor: pointer;
}

.theme-switch-sun,
.theme-switch-moon,
.theme-switch-knob {
  position: absolute;
  display: block;
  top: 7px;
  width: 9px;
  height: 9px;
}

.theme-switch-sun {
  left: 7px;
  border-radius: 50%;
  background: var(--color-switch-sun);
}

.theme-switch-moon {
  right: 7px;
  border: 1.5px solid var(--color-switch-moon);
  border-radius: 50%;
}

.theme-switch-knob {
  top: 3px;
  left: 31px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-foreground);
  transition: left 160ms ease;
}

html[data-theme="light"] .theme-switch-knob {
  left: 3px;
}

/* 4. Homepage */

.hero h1 {
  font-size: clamp(4rem, 9.72vw, 8.75rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.06em;
}

.hero h1 span {
  display: block;
  white-space: nowrap;
}

.hero .intro {
  color: var(--color-foreground);
  font-size: 18px;
  font-weight: 700;
}

.intro-notes {
  color: var(--color-section-notes);
}

.intro-photos {
  color: var(--color-section-photos);
}

.intro-projects {
  color: var(--color-section-projects);
}

.intro-and {
  color: var(--color-foreground);
}

.intro-things {
  color: var(--color-section-things);
}

/* 5. Notes listing */

.note-list {
  max-width: 760px;
  margin: clamp(56px, 8vw, 88px) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-line);
}

.note-list li {
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--color-line);
}

.note-list li article {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.note-list h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.15;
}

.note-list h2 a {
  text-decoration: none;
}

.note-list h2 a:hover,
.note-list h2 a:focus-visible {
  text-decoration-line: underline;
}

.note-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* 6. Individual note page */

/* Header — eyebrow retained for optional restoration in the template. */

.note-header .eyebrow {
  color: var(--color-body);
}

.note-header h1 {
  color: var(--color-section-notes);
  font-weight: 700;
}

.note-summary {
  max-width: 700px;
  margin-top: 1px;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.note-header .note-summary {
  color: var(--color-body);
  font-weight: 700;
}

.note-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* Body — paragraph justification excludes headings and lists. */

.prose {
  max-width: calc(100%);
  margin-top: clamp(20px, 7vw, 40px);
  font-size: 1.05rem;
  padding-inline: 100px;
}

.note > .prose {
  color: var(--color-foreground);
}

.note > .prose > p {
  text-align: justify;
  text-align-last: left;
}

/* Markdown headings — kept separate for independent styling. */

/* Markdown # / H1 */

.note .prose h1 {
  color: var(--section-accent);
  font-size: 2em;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: normal;
  margin: 1.5em 0 0.5em;
}

/* Markdown ## / H2 */

.note .prose h2 {
  color: var(--section-accent);
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: normal;
  margin: 1.5em 0 0.5em;
}

/* Markdown ### / H3 */

.note .prose h3 {
  color: var(--section-accent);
  font-size: 1.17em;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: normal;
  margin: 1.5em 0 0.5em;
}

/* Trim outer content margins, including when a heading comes first or last. */

.note .prose > :first-child {
  margin-top: 0;
}

.note .prose > :last-child {
  margin-bottom: 0;
}

/* Inline images — extra inset inside the prose padding; not related-photo thumbnails. */

.prose img {
  display: block;
  max-width: calc(100% - 50px);
  height: auto;
  margin: 1.75em auto;
}

.note-attachment-link {
  display: block;
}

/* Related content below the note — intentionally separate from the header pill. */

.note-related-photos,
.note-related-things {
  max-width: 1000px;
  margin-top: clamp(48px, 7vw, 72px);
}

.note-related-photos h2,
.note-related-things h2 {
  margin: 0;
  color: var(--section-accent);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.note-related-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 32px);
  margin-top: 24px;
}

.note-related-photo {
  margin: 0;
}

.note-related-photo a {
  display: block;
}

.note-related-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.note-related-photo figcaption {
  margin-top: 14px;
  color: var(--color-body);
  line-height: 1.6;
}

.note-relationships {
  display: grid;
  gap: 8px;
  margin-top: 32px;
}

.note-relationships .note-related-things {
  margin-top: 0;
}

.note-thing {
  margin: 18px 0 0;
}

.note-return {
  margin: 75px 0 0;
  font-size: 0.80rem;
}

/* 7. Photos, Projects, and Things */

/* Photos */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(20px, 3vw, 36px);
  margin-top: clamp(56px, 8vw, 88px);
}

.photo {
  margin: 0;
}

.photo-link {
  display: block;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
}

.photo figcaption {
  margin-top: 14px;
  color: var(--color-body);
  line-height: 1.6;
}

.photo-related-notes {
  margin-top: 18px;
}

/* Projects */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(20px, 3vw, 32px);
  margin-top: clamp(56px, 8vw, 88px);
}

.project-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 220px;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid var(--color-line);
}

.project-notes {
  margin-top: 24px;
}

.project-status {
  margin-top: auto;
  padding-top: 28px;
}

/* Things */

.things-list {
  margin-top: clamp(56px, 8vw, 88px);
  border-top: 1px solid var(--color-line);
}

.thing {
  display: grid;
  grid-template-columns: minmax(180px, 0.95fr) minmax(260px, 1.7fr) auto;
  align-items: start;
  gap: 24px;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--color-line);
}

.thing h2 {
  margin-top: 0;
}

.thing-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.thing-download {
  margin: 0;
  font-size: 0.88rem;
  white-space: nowrap;
}

.thing-related-notes {
  margin-top: 20px;
}

/* 8. Shared components */

/* Content links and project pills */

.note-return a,
.thing h2 a,
.thing-download a {
  text-decoration-line: underline;
  font-weight: 600;
}

.note-thing a,
.project-notes a {
  text-decoration-line: underline;
}

.note-project,
.note-thing {
  font-size: 0.88rem;
}

.note-project {
  margin: 0;
  color: var(--color-section-projects);
}

/* Required override: .note-list p would otherwise make the project pill body-colored. */

.note-list .note-project {
  color: var(--color-section-projects);
}

.note-project a {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.15rem 0.65rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  text-decoration: none;
}

/* Related-note lists — shared appearance, with page-specific outer spacing above. */

.photo-related-notes-label,
.thing-related-notes-label,
.project-notes-label {
  margin: 0 0 10px;
  color: var(--color-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-related-notes-list,
.thing-related-notes-list,
.project-notes-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--color-body);
  font-size: 0.88rem;
  line-height: 1.45;
}

.photo-related-notes a,
.thing-related-notes a {
  text-decoration-line: underline;
}

.photo-related-notes-older,
.thing-related-notes-older,
.project-notes-older {
  margin-top: 12px;
  color: var(--color-body);
  font-size: 0.88rem;
}

.photo-related-notes-older summary,
.thing-related-notes-older summary,
.project-notes-older summary {
  cursor: pointer;
}

.photo-related-notes-older .photo-related-notes-list,
.thing-related-notes-older .thing-related-notes-list,
.project-notes-older .project-notes-list {
  margin-top: 12px;
}

/* Image viewers — identical controls for inline-note images and the Photos page. */

.note-image-viewer,
.photo-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.note-image-viewer[open],
.photo-viewer[open] {
  display: grid;
  place-items: center;
}

.note-image-viewer::backdrop,
.photo-viewer::backdrop {
  background: rgb(0 0 0 / 0.92);
}

.note-image-viewer-image,
.photo-viewer-image {
  display: block;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.note-image-viewer-close,
.photo-viewer-close {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 10px 14px;
  border: 1px solid var(--color-foreground);
  border-radius: 0;
  background: var(--color-background);
  color: var(--color-foreground);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

/* 9. Responsive overrides */

/* Small screens — shared layout changes; page-specific heading sizes remain in force. */

@media (max-width: 600px) {
  :root {
    --space-page-start: clamp(32px, 10vw, 40px);
    --space-page-end: clamp(40px, 12vw, 48px);
  }

  .site-shell {
    width: min(100% - 32px, 1100px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    min-height: 112px;
    padding: 18px 0;
  }

  .site-navigation {
    justify-content: flex-start;
    gap: 8px 18px;
  }

  .hero h1 {
    font-size: clamp(2.5rem, 15.2vw, 4rem);
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .thing {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 20px;
  }

  .thing-title {
    min-width: 0;
  }

  .thing-description {
    grid-column: 1 / -1;
  }

  .thing-details {
    grid-column: 1 / -1;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }
}

/* Narrow phones only — remove prose padding; retain justification and image inset. */

@media (max-width: 480px) {
  .note > .prose {
    padding-inline: 0;
  }
}

/* Medium screens — two-column Photos grid. */

@media (min-width: 601px) and (max-width: 900px) {
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
