/* ── Kami tokens ── */
:root {
  --bg:       #f5f4ed;
  --surface:  #faf9f5;
  --fg:       #141413;
  --muted:    #3d3d3a;
  --subtle:   #504e49;
  --stone:    #6b6a64;
  --border:   #e8e6dc;
  --brand:    #1B365D;
  --brand-lt: #2D5A8A;
  --tag-bg:   #E4ECF5;

  --serif: "Victor Mono", "JetBrains Mono", "SF Mono", Consolas, monospace;
  --mono:  "Victor Mono", "JetBrains Mono", "SF Mono", Consolas, monospace;

  --art-w: 320px;
  --pad-x: 32px;
}

[data-theme="dark"] {
  --bg:      #141413;
  --surface: #1e1e1c;
  --fg:      #faf9f5;
  --muted:   #c8c6be;
  --subtle:  #a09e97;
  --stone:   #6b6a64;
  --border:  #2e2d2a;
  --brand:   #7aaddc;
  --brand-lt:#a8ccee;
  --tag-bg:  #1e2d3d;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  transition: background 0.2s, color 0.2s;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  min-height: 100vh;
}

/* ── Three-column layout ── */
.layout {
  display: grid;
  grid-template-columns: var(--art-w) 1fr var(--art-w);
  min-height: 100vh;
  align-items: start;
}

/* ── Painting columns ── */
.art-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.art-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* ── Center content ── */
.page {
  padding: 52px var(--pad-x) 80px;
  background: var(--bg);
  min-height: 100vh;
}

strong { font-weight: 500; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top-right controls (fixed) ── */
.top-controls {
  position: fixed;
  top: 18px;
  right: calc(var(--art-w) + 16px);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
}

.search-wrap { position: relative; }

#search-input {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  width: 120px;
  outline: none;
  transition: border-color 0.15s, width 0.2s, opacity 0.15s;
  opacity: 0.7;
}
#search-input:focus {
  opacity: 1;
  border-color: var(--brand);
  width: 180px;
}
#search-input::placeholder { color: var(--stone); }

.search-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--stone);
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  letter-spacing: 0.02em;
}
#search-input:focus + .search-hint { display: none; }

.theme-toggle {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }

/* ── Search overlay ── */
#search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,20,19,0.5);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
#search-overlay.open { display: flex; }

.search-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 560px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  overflow: hidden;
}

.search-modal-input {
  width: 100%;
  font-family: var(--mono);
  font-size: 15px;
  background: transparent;
  color: var(--fg);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  outline: none;
  letter-spacing: 0.01em;
}
.search-modal-input::placeholder { color: var(--stone); }

.search-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0;
}

.search-result-item {
  padding: 10px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.1s;
}
.search-result-item:hover,
.search-result-item.active { background: var(--tag-bg); }

.search-result-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--brand);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.search-result-title {
  font-size: 14px;
  color: var(--fg);
  font-weight: 500;
}

.search-empty {
  padding: 24px 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--stone);
}

/* ── Header ── */
.header { margin-bottom: 52px; }

.header-name {
  font-size: 18px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
}

.header-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--stone);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  font-family: var(--mono);
  font-size: 13px;
}
.header-links a { color: var(--brand); }
.header-links span { color: var(--stone); margin: 0 8px; user-select: none; }

/* ── Section ── */
section { margin-bottom: 52px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 20px;
}

.section-label {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--brand);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--stone);
  letter-spacing: 0.02em;
}

/* ── About ── */
.about-text { font-size: 14px; line-height: 1.6; color: var(--fg); }

/* ── Now ── */
.now-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.now-list li { font-size: 14px; color: var(--fg); padding-left: 16px; position: relative; }
.now-list li::before { content: "–"; position: absolute; left: 0; color: var(--brand); }

/* ── Work ── */
.work-table { width: 100%; border-collapse: collapse; }
.work-table tr { border-bottom: 1px solid var(--border); }
.work-table tr:last-child { border-bottom: none; }
.work-table td { padding: 10px 0; font-size: 14px; vertical-align: top; }
.work-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--stone);
  white-space: nowrap;
  padding-right: 48px;
  padding-top: 12px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.work-role { font-weight: 500; color: var(--fg); }
.work-where { color: var(--brand); }

/* ── Projects ── */
.project-item { margin-bottom: 20px; }
.project-item:last-child { margin-bottom: 0; }
.project-title { font-size: 14px; font-weight: 500; color: var(--fg); display: inline; }
.project-title a { color: var(--fg); }
.project-title a:hover { color: var(--brand); text-decoration: none; }
.project-tags {
  display: inline;
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--stone);
  letter-spacing: 0.02em;
}
.project-desc { font-size: 13px; color: var(--subtle); line-height: 1.5; margin-top: 3px; }

/* ── Writings ── */
.writing-item { margin-bottom: 24px; }
.writing-item:last-child { margin-bottom: 0; }

.writing-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--stone);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.writing-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
  display: block;
}
.writing-title:hover { color: var(--brand); text-decoration: none; }
.writing-excerpt { font-size: 13px; color: var(--subtle); line-height: 1.5; }

.all-link {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--brand);
  letter-spacing: 0.02em;
}

/* ── Stuff That Caught My Eye ── */
.eye-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.eye-item {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  background: var(--surface);
  transition: box-shadow 0.2s;
}
.eye-item:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.05); }
.eye-item-type {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--brand);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.eye-item-title { font-size: 13px; font-weight: 500; color: var(--fg); margin-bottom: 4px; }
.eye-item-note { font-size: 12px; color: var(--subtle); line-height: 1.5; }

/* ── Footer ── */
footer { border-top: 1px solid var(--border); padding-top: 20px; }

/* ── Responsive: hide paintings below 900px ── */
@media (max-width: 900px) {
  :root { --art-w: 0px; }
  .art-panel { display: none; }
  .layout { grid-template-columns: 1fr; }
  .top-controls { right: 16px; }
}

@media (max-width: 600px) {
  :root { --pad-x: 20px; }
  .top-controls { top: 14px; }
  #search-input { width: 90px; }
  #search-input:focus { width: 140px; }
  .eye-grid { grid-template-columns: 1fr; }
  .work-date { padding-right: 12px; font-size: 11px; }
}

@media (max-width: 400px) {
  .search-hint { display: none; }
}