/* ============================================================
   bikarys.dev — style.css
   Organized: tokens, base, layout, header, hero, cards, blog,
   article, footer, utilities.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Light theme: warm paper, ink, signal red-orange */
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #efe8da;
  --ink: #111111;
  --muted: #4a4a4a;
  --line: #d8d0c0;
  --pattern-line: rgba(17, 17, 17, 0.08);
  --accent: #e5482d;
  --accent-strong: #a8321d;
  --accent-soft: rgba(229, 72, 45, 0.12);
  --mark-bg: #e5482d;
  --mark-ink: #111111;
  --code-bg: #111111;
  --code-ink: #f6f1e7;
  --header-bg: rgba(246, 241, 231, 0.92);
  --btn-bg: #111111;
  --btn-ink: #f6f1e7;
  --btn-border: #111111;
  --btn-secondary-bg: transparent;
  --btn-secondary-ink: #111111;
  --shadow: 0 12px 0 rgba(17, 17, 17, 0.08);
  --shadow-hover: 0 18px 0 rgba(17, 17, 17, 0.12);
  --radius: 14px;
  --radius-small: 10px;
  --bg-pattern: none;
  --bg-pattern-size: auto;

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Dark tokens defined once, mapped below */
  --dark-bg: #0b0f0e;
  --dark-surface: #101615;
  --dark-surface-2: #15201e;
  --dark-ink: #e9f5f1;
  --dark-muted: #9fb8b0;
  --dark-line: #243431;
  --dark-pattern-line: rgba(184, 243, 74, 0.14);
  --dark-accent: #b8f34a;
  --dark-accent-strong: #b8f34a;
  --dark-accent-soft: rgba(184, 243, 74, 0.12);
  --dark-mark-bg: #b8f34a;
  --dark-mark-ink: #0b0f0e;
  --dark-code-bg: #08100f;
  --dark-code-ink: #e9f5f1;
  --dark-header-bg: rgba(11, 15, 14, 0.86);
  --dark-btn-bg: #b8f34a;
  --dark-btn-ink: #0b0f0e;
  --dark-btn-border: #b8f34a;
  --dark-btn-secondary-bg: rgba(255, 255, 255, 0.03);
  --dark-btn-secondary-ink: #e9f5f1;
  --dark-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --dark-shadow-hover: 0 0 0 1px rgba(184, 243, 74, 0.12), 0 18px 40px rgba(0, 0, 0, 0.35);
  --dark-bg-pattern:
    radial-gradient(rgba(159, 184, 176, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  --dark-bg-pattern-size: 28px 28px, 140px 140px, 140px 140px;
}

/* Explicit dark theme */
:root[data-theme="dark"] {
  --bg: var(--dark-bg);
  --surface: var(--dark-surface);
  --surface-2: var(--dark-surface-2);
  --ink: var(--dark-ink);
  --muted: var(--dark-muted);
  --line: var(--dark-line);
  --pattern-line: var(--dark-pattern-line);
  --accent: var(--dark-accent);
  --accent-strong: var(--dark-accent-strong);
  --accent-soft: var(--dark-accent-soft);
  --mark-bg: var(--dark-mark-bg);
  --mark-ink: var(--dark-mark-ink);
  --code-bg: var(--dark-code-bg);
  --code-ink: var(--dark-code-ink);
  --header-bg: var(--dark-header-bg);
  --btn-bg: var(--dark-btn-bg);
  --btn-ink: var(--dark-btn-ink);
  --btn-border: var(--dark-btn-border);
  --btn-secondary-bg: var(--dark-btn-secondary-bg);
  --btn-secondary-ink: var(--dark-btn-secondary-ink);
  --shadow: var(--dark-shadow);
  --shadow-hover: var(--dark-shadow-hover);
  --bg-pattern: var(--dark-bg-pattern);
  --bg-pattern-size: var(--dark-bg-pattern-size);
}


/* ---------- Base ---------- */
.project-content ul, .post-content ul, .page-content ul { list-style: disc; padding-left: 1.4em; }
.project-content ol, .post-content ol, .page-content ol { list-style: decimal; padding-left: 1.4em; }
.project-content li::marker, .post-content li::marker, .page-content li::marker { color: var(--accent); }

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-pattern);
  background-size: var(--bg-pattern-size);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

::selection {
  background: var(--accent);
  color: var(--mark-ink);
}

/* ---------- Layout ---------- */
.container {
  width: min(1200px, calc(100% - 40px));
  margin-inline: auto;
}

.section {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
}

.section-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem 2rem;
  align-items: end;
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--ink);
}

.section-head .eyebrow {
  grid-column: 1 / -1;
}

.section-head h1,
.section-head h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  line-height: 0.95;
}

.section-note {
  margin: 0;
  color: var(--muted);
  max-width: 48ch;
  justify-self: end;
  font-size: 1.05rem;
}

.section-link {
  margin-top: 2rem;
}

.section-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--accent-strong);
}

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

.section-link svg {
  width: 18px;
  height: 18px;
  transition: transform 0.18s ease;
}

.section-link a:hover svg {
  transform: translateX(4px);
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.95rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--ink);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding-block: 0.75rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

.brand-mark {
  width: 28px;
  height: 28px;
  color: var(--accent-strong);
}

.nav {
  margin-left: auto;
}

.nav ul {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.nav a {
  position: relative;
  padding: 0.25rem 0;
  font-weight: 700;
  color: var(--ink);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.nav a:hover::after,
.nav a:focus-visible::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-link,
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.icon-link:hover,
.theme-toggle:hover {
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-1px);
}

.icon-link svg,
.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Theme toggle icon visibility */
.theme-toggle .icon-moon {
  display: none;
}

.theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}


.no-js .theme-toggle {
  display: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3.5rem, 9vw, 7rem) 0;
  border-bottom: 2px solid var(--ink);
  overflow: clip;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.hero-title {
  margin-top: 0.75rem;
  font-size: clamp(2.5rem, 5.8vw, 4.3rem);
  line-height: 1.08;
}

mark {
  display: inline;
  line-height: 1.1;
  background: var(--mark-bg);
  color: var(--mark-ink);
  padding: 0 0.16em;
  margin: 0 0.02em;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.hero-sub {
  margin-top: 1.25rem;
  max-width: 54ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.85rem 1.25rem;
  border: 2px solid var(--btn-border);
  border-radius: var(--radius-small);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary {
  background: var(--btn-bg);
  color: var(--btn-ink);
  border-color: var(--btn-border);
}

.btn--primary:hover {
  background: var(--accent);
  color: var(--mark-ink);
  border-color: var(--accent);
}

.btn--secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-ink);
  border-color: var(--ink);
}

.btn--secondary:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.hero-visual {
  position: relative;
  margin-top: 1rem;
}

.collage {
  position: relative;
  min-height: 460px;
}

.collage-window {
  position: absolute;
  margin: 0;
  width: 72%;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.collage-window:nth-child(1) {
  top: 0;
  right: 0;
  transform: rotate(-4deg);
  z-index: 2;
}

.collage-window:nth-child(2) {
  bottom: 0;
  left: 0;
  transform: rotate(5deg);
  z-index: 1;
}

.collage-window:nth-child(n + 3) {
  display: none;
}

.collage-window img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

/* ---------- Window / code panels ---------- */
.window {
  display: block;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  border-bottom: 2px solid var(--ink);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.dot:nth-child(3) {
  background: var(--accent);
  opacity: 0.85;
}

.window-title {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.code-panel {
  min-width: 0;
  max-width: 100%;
  background: var(--code-bg);
  color: var(--code-ink);
}

.code-panel .window-bar {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.code-panel .window-title {
  color: var(--muted);
}

.code-panel pre {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--code-ink);
}

.code-panel code {
  font-family: var(--mono);
}

/* ---------- Cards / projects ---------- */
.icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--accent-strong);
}

.icon svg {
  width: 24px;
  height: 24px;
}

.icon--large {
  width: 56px;
  height: 56px;
}

.icon--large svg {
  width: 30px;
  height: 30px;
}

/* Project bento */
.bento {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  counter-reset: project;
}

.project-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  counter-increment: project;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.project-card--cover {
  grid-column: 1 / -1;
}

.project-media {
  display: block;
  border-bottom: 2px solid var(--ink);
  background: var(--surface-2);
}

.project-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.project-body {
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.project-top {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.card-number {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 0.8;
  color: var(--accent);
}

.card-number::before {
  content: counter(project, decimal-leading-zero);
}

.project-title {
  margin-top: 0.25rem;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  line-height: 1;
}

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

.working-name {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pitch {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags li {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--released {
  background: var(--accent);
  color: var(--mark-ink);
  border-color: var(--accent);
}

.badge--soon {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink);
}

.card-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  color: var(--ink);
}

.card-link:hover {
  color: var(--accent-strong);
}

.card-link svg {
  width: 18px;
  height: 18px;
  transition: transform 0.18s ease;
}

.card-link:hover svg {
  transform: translateX(4px);
}

/* ---------- Blog / posts ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.post-list {
  display: grid;
  gap: 1.5rem;
}

.post-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.post-card--featured {
  grid-template-columns: minmax(280px, 1.2fr) 1.8fr;
}

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

.post-thumb {
  display: block;
  border-right: 2px solid var(--ink);
  background: var(--surface-2);
  overflow: hidden;
}

.post-grid .post-thumb {
  border-right: 0;
  border-bottom: 2px solid var(--ink);
}

.post-thumb img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.post-card-body {
  padding: 1.5rem;
  display: grid;
  align-content: start;
  gap: 0.9rem;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-meta time {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}

.post-title {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.05;
}

.post-card--featured .post-title {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}

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

.post-desc {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.post-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-strong);
}

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

.post-link svg {
  width: 16px;
  height: 16px;
}

/* Cover fallback */
.cover-fallback {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--accent-soft);
  color: var(--ink);
}

.cover-fallback-pattern {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 10px,
      var(--pattern-line) 10px,
      var(--pattern-line) 12px
    ),
    linear-gradient(180deg, var(--surface-2), var(--surface));
}


.cover-fallback-content {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.75rem;
}

.cover-fallback-tag {
  align-self: flex-start;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cover-fallback-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  line-height: 1.05;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Project page ---------- */
.project-page {
  padding: 3rem 0 4rem;
}

.project-page-header {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--ink);
}

.project-page-top {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.project-page-number {
  counter-reset: project var(--project-index, 0);
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  line-height: 0.8;
  color: var(--accent);
}

.project-page-number::before {
  content: counter(project, decimal-leading-zero);
}

.project-page-title-wrap {
  flex: 1;
}

.project-page-title {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 0.95;
}

.project-page-description {
  margin-top: 1rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  max-width: 68ch;
}

.project-page-meta {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-cover {
  margin: 0 0 2rem;
}

.project-cover img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.project-content {
  max-width: 72ch;
}

.project-content p,
.project-content ul,
.project-content ol,
.project-content blockquote,
.project-content pre {
  margin-bottom: 1.25rem;
}

.project-content h2,
.project-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.project-content h2 {
  font-size: 2rem;
}

.project-content h3 {
  font-size: 1.4rem;
}

.project-content a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.project-content code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.15em 0.35em;
  border-radius: 4px;
  background: var(--surface-2);
}

.project-content pre {
  padding: 1.25rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow-x: auto;
}

.project-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.project-content blockquote {
  padding-left: 1rem;
  border-left: 4px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.gallery {
  margin-top: 3rem;
}

.gallery h2 {
  margin-bottom: 1.5rem;
  font-size: 2rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.gallery-item {
  display: block;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  overflow: hidden;
  background: var(--surface);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.project-page-footer {
  margin-top: 3rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--accent-strong);
}

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

/* ---------- Article / generic page ---------- */
.post,
.page {
  padding: 3rem 0 4rem;
}

.post-header,
.page-header {
  max-width: 60rem;
  margin-inline: auto;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--ink);
}

.post-header .post-meta,
.page-header .post-meta {
  margin-bottom: 1rem;
}

.post-header .post-title,
.page-title {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 0.95;
}

.lead {
  margin-top: 1rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  max-width: 68ch;
}

.post-cover {
  margin: 2rem 0 0;
}

.post-cover img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.post-content,
.page-content {
  max-width: 60rem;
  margin-inline: auto;
  font-size: 1.125rem;
}

.post-content p,
.page-content p,
.post-content ul,
.page-content ul,
.post-content ol,
.page-content ol,
.post-content blockquote,
.page-content blockquote,
.post-content pre,
.page-content pre {
  margin-bottom: 1.25rem;
}

.post-content h2,
.page-content h2,
.post-content h3,
.page-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.post-content h2,
.page-content h2 {
  font-size: 2rem;
}

.post-content h3,
.page-content h3 {
  font-size: 1.4rem;
}

.post-content a,
.page-content a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content a:hover,
.page-content a:hover {
  color: var(--accent);
}

.post-content code,
.page-content code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.15em 0.35em;
  border-radius: 4px;
  background: var(--surface-2);
}

.post-content pre,
.page-content pre {
  padding: 1.25rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow-x: auto;
}

.post-content pre code,
.page-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.post-content blockquote,
.page-content blockquote {
  padding-left: 1rem;
  border-left: 4px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.post-footer {
  margin-top: 3rem;
}

.writing-note {
  margin: 0 0 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

.writing-note a {
  color: var(--accent-strong);
}

/* ---------- 404 ---------- */
.not-found {
  text-align: center;
  padding: 6rem 0;
}

.not-found h1 {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  margin-bottom: 1rem;
}

.not-found-text {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.not-found-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 2rem 0;
  border-top: 2px solid var(--ink);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.footer-links {
  display: flex;
  gap: 0.75rem;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.footer-link:hover {
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-1px);
}

.footer-link svg {
  width: 20px;
  height: 20px;
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ---------- Utilities ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -50px;
  z-index: 50;
  padding: 0.6rem 0.8rem;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  border-radius: 0 0 8px 8px;
}

.skip-link:focus {
  top: 1rem;
}

.simple-list {
  display: grid;
  gap: 0.75rem;
}

.simple-list a {
  display: inline-block;
  padding: 0.75rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-small);
  background: var(--surface);
  font-weight: 700;
}

.simple-list a:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    margin-top: 2.5rem;
  }

  .collage {
    min-height: 380px;
  }

  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }


  .section-head {
    grid-template-columns: 1fr;
  }

  .section-note {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 2rem);
  }

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

  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .header-actions {
    order: 2;
    margin-left: auto;
  }

  .section {
    padding: 2.5rem 0;
  }

  .hero {
    padding: 2.5rem 0;
  }

  .hero-title {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }

  .collage {
    min-height: 320px;
  }

  .collage-window {
    width: 82%;
  }

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

  .project-card--cover {
    grid-column: auto;
  }

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

  .post-card,
  .post-card--featured {
    grid-template-columns: 1fr;
  }

  .post-thumb {
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

  .project-page-top {
    flex-direction: column;
  }

  .project-page-number {
    font-size: 3.5rem;
  }

  .project-page-meta,
  .project-meta {
    justify-content: flex-start;
  }

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

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    transform: none !important;
  }
}

.post-grid .post-title {
  font-size: 1.2rem;
  line-height: 1.15;
}

/* Home: asymmetric project mosaic (7/5, then 5/7) */
.mosaic {
  display: grid;
  counter-reset: project;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}
.mosaic > :nth-child(4n + 1),
.mosaic > :nth-child(4n + 4) { grid-column: span 7; }
.mosaic > :nth-child(4n + 2),
.mosaic > :nth-child(4n + 3) { grid-column: span 5; }
@media (max-width: 980px) {
  .mosaic > * { grid-column: 1 / -1 !important; }
}
.mosaic .code-panel { flex: 1; }
.mosaic .project-title { font-size: clamp(1.2rem, 1.8vw, 1.4rem); overflow-wrap: anywhere; }

/* Blog tag filter */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.tag-filter a {
  padding: 0.35rem 0.85rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
}
.tag-filter a span { color: var(--muted); font-weight: 400; }
.tag-filter a:hover { border-color: var(--accent); color: var(--accent-strong); }
.tag-filter a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.tag-filter a[aria-current="page"] span { color: inherit; opacity: 0.7; }
.tags a:hover { color: var(--accent-strong); }
.mosaic > :last-child:nth-child(4n + 1) { grid-column: 1 / -1; }

.icon--logo {
  padding: 0;
  object-fit: cover;
}
