/*
 * Kyoto Seed Balls — web presentation
 * Borrowed bones from What Comes Through. Adapted for plants.
 */

/* ---- Palette ---- */
:root {
  --bg: #faf8f5;
  --bg-subtle: #f3f0eb;
  --text: #2c2825;
  --text-secondary: #6b6560;
  --text-tertiary: #9b9590;

  --warm: #c4725a;
  --warm-light: #e8c4b8;
  --warm-subtle: #f2e0d8;

  --cool: #5a7a8a;
  --cool-light: #b8ced8;

  --gap: #d4a574;

  /* Layout */
  --content-width: 38rem;
  --nav-width: 10rem;
  --gutter: 2rem;

  /* Typography */
  --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --text-base: 1.125rem;
  --text-sm: 0.9375rem;
  --text-xs: 0.8125rem;
  --text-lg: 1.375rem;
  --text-h1: 2.25rem;
  --text-h2: 1.625rem;
  --text-h3: 1.25rem;

  --leading: 1.7;
  --leading-tight: 1.3;
}

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

/* ---- Base ---- */
html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
}

/* ---- Page structure ---- */
.page {
  max-width: calc(var(--content-width) + var(--nav-width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
  padding-left: calc(var(--nav-width) + var(--gutter) + 1.5rem);
  position: relative;
}

.content {
  max-width: var(--content-width);
}

/* ---- Left sidebar nav ---- */
.section-nav {
  position: fixed;
  top: 4rem;
  left: max(1rem, calc((100vw - var(--content-width) - var(--nav-width) - var(--gutter)) / 2 - 1rem));
  width: var(--nav-width);
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  padding-right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  z-index: 10;

  scrollbar-width: none;
  -ms-overflow-style: none;
}

.section-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-decoration: none;
  border-bottom: none;
  padding: 0.3rem 0 0.3rem 0.75rem;
  border-left: 2px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
  line-height: 1.4;
}

.nav-link:hover {
  color: var(--text-secondary);
  border-bottom: none;
}

.nav-link.active {
  color: var(--text-secondary);
  border-left-color: var(--warm);
}

.nav-jp {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
  opacity: 0.7;
  margin-top: 0.05rem;
}

.nav-link.active .nav-jp {
  opacity: 1;
}

/* ---- Typography ---- */
h1 {
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--text);
}

h2 {
  font-size: var(--text-h2);
  line-height: var(--leading-tight);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-top: 4rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

h3 {
  font-size: var(--text-h3);
  line-height: var(--leading-tight);
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text);
}

p {
  margin-bottom: 1.25rem;
}

.subtitle {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-top: -0.25rem;
  margin-bottom: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.attribution {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 3rem;
  font-style: italic;
}

/* ---- Horizontal rules ---- */
hr {
  border: none;
  height: 1px;
  background: var(--warm-light);
  margin: 3.5rem 0;
}

/* ---- Links ---- */
a {
  color: var(--warm);
  text-decoration: none;
  border-bottom: 1px solid var(--warm-light);
  transition: border-color 0.2s ease;
}

a:hover {
  border-bottom-color: var(--warm);
}

/* ---- Blockquotes ---- */
blockquote {
  border-left: 2px solid var(--warm-light);
  padding-left: 1.25rem;
  margin: 2rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

blockquote em {
  font-style: normal;
}

/* ---- Plant sections ---- */
.plant-section {
  scroll-margin-top: 2rem;
}

.plant-header {
  margin-bottom: 1.5rem;
}

.plant-name-jp {
  font-size: var(--text-h2);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.plant-name-en {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
}

/* ---- Plant images ---- */
.plant-image-wrap {
  margin: 1.5rem 0 2rem;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-subtle);
}

.plant-image-wrap img {
  display: block;
  width: 100%;
  height: 20rem;
  object-fit: cover;
  border-radius: 4px;
}

/* ---- Plant info table ---- */
.plant-info {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0 2rem;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.plant-info th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid #ece8e3;
  white-space: nowrap;
  vertical-align: top;
  width: 8rem;
}

.plant-info td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #ece8e3;
  color: var(--text);
  line-height: 1.5;
}

.plant-info tr:last-child th,
.plant-info tr:last-child td {
  border-bottom: none;
}

.plant-info td em {
  font-style: italic;
}

/* ---- Plant notes / tips ---- */
.plant-tip {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin: 1rem 0 0;
  line-height: 1.6;
}

/* ---- How-to section ---- */
.how-to-list {
  list-style: none;
  counter-reset: steps;
  margin: 1.25rem 0;
}

.how-to-list li {
  counter-increment: steps;
  padding: 0.5rem 0 0.5rem 2.5rem;
  position: relative;
  line-height: 1.6;
}

.how-to-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--warm);
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1.75rem;
  text-align: center;
  border-radius: 50%;
  background: var(--warm-subtle);
}

/* ---- Priority list ---- */
.priority-list {
  list-style: none;
  counter-reset: priority;
  margin: 1.25rem 0;
}

.priority-list li {
  counter-increment: priority;
  padding: 0.4rem 0 0.4rem 2.5rem;
  position: relative;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.priority-list li::before {
  content: counter(priority);
  position: absolute;
  left: 0;
  top: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--warm);
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1.75rem;
  text-align: center;
  border-radius: 50%;
  background: var(--warm-subtle);
}

/* ---- Materials list ---- */
.materials {
  list-style: none;
  margin: 1rem 0;
}

.materials li {
  padding: 0.3rem 0 0.3rem 1.5rem;
  position: relative;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.materials li::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.85rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warm-light);
}

/* ---- Scatter locations ---- */
.location-list {
  list-style: none;
  margin: 1rem 0;
}

.location-list li {
  padding: 0.3rem 0 0.3rem 1.5rem;
  position: relative;
  font-size: var(--text-sm);
  line-height: 1.6;
}

.location-list.do li::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.85rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warm-light);
}

.location-list.dont li::before {
  content: '—';
  position: absolute;
  left: 0;
  top: 0.15rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ---- Concept box ---- */
.concept {
  background: var(--bg-subtle);
  border-left: 3px solid var(--warm-light);
  padding: 0.9rem 1.25rem;
  margin: 1.5rem 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.concept strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- Ratio box ---- */
.ratio-box {
  background: #fff;
  border: 1px solid #e8e5e0;
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  margin: 1.25rem 0 2rem;
  text-align: center;
}

.ratio-main {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
}

.ratio-note {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: 0.6rem;
}

.ratio-alt {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
}

/* ---- Clay type romaji ---- */
.clay-romaji {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-style: italic;
  font-weight: 400;
}

/* ---- Quick reference card ---- */
.quick-ref {
  background: var(--bg-subtle);
  border: 1px solid #e8e5e0;
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  margin: 1.25rem 0;
}

.quick-ref pre {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  margin: 0;
}

/* ---- Japanese phrase callout ---- */
.phrase-box {
  background: #fff;
  border: 1px solid #e8e5e0;
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.phrase-jp {
  font-size: var(--text-lg);
  color: var(--text);
  margin-bottom: 0.5rem;
}

.phrase-romaji {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.phrase-en {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ---- Selection ---- */
::selection {
  background: var(--warm-subtle);
  color: var(--text);
}

/* ---- Responsive ---- */
@media (max-width: 56rem) {
  .page {
    max-width: var(--content-width);
    padding-left: 1.5rem;
  }

  .section-nav {
    display: none;
  }

  .plant-image-wrap img {
    height: 16rem;
  }
}

@media (max-width: 36rem) {
  .plant-image-wrap img {
    height: 12rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .plant-name-jp {
    font-size: 1.375rem;
  }
}

/* ---- Print ---- */
@media print {
  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  .section-nav {
    display: none;
  }

  .plant-image-wrap img {
    height: auto;
    max-height: 14rem;
  }
}
