/* tanso.wiki — ethereal carbon encyclopedia */

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

:root {
  --parchment: #e8dcc8;
  --umber: #5a4030;
  --teal: #3a7a8a;
  --sand: #f0e8d8;
  --coral: #c4887a;
  --moss: #5a7a4a;
  --deep-earth: #3a2e20;
}

html, body {
  background: var(--parchment);
  color: var(--umber);
  font-family: "Lora", Georgia, serif;
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(circle at 20% 0%, rgba(244, 232, 212, 0.9), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(196, 136, 122, 0.12), transparent 55%),
    linear-gradient(180deg, #f0e6d2 0%, #e8dcc8 50%, #ddcfb6 100%);
  min-height: 100vh;
}

::selection { background: rgba(58, 122, 138, 0.25); color: var(--deep-earth); }

/* ---------- masthead ---------- */
.masthead {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px clamp(20px, 5vw, 60px);
  overflow: hidden;
}

.parchment-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 250, 240, 0.45), transparent 60%),
    radial-gradient(circle at 70% 70%, rgba(196, 136, 122, 0.08), transparent 65%);
  mix-blend-mode: soft-light;
}

.masthead-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(280px, 1fr);
  gap: clamp(30px, 5vw, 80px);
  align-items: center;
  max-width: 1100px;
  width: 100%;
}

.atom-illus {
  width: 100%;
  height: auto;
  max-width: 320px;
  opacity: 0;
  animation: atom-in 1500ms 200ms ease forwards;
}

.atom-illus g[stroke="#3a2e20"] ellipse,
.atom-illus g[stroke="#3a2e20"] circle {
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: draw-line 2200ms 400ms ease-out forwards;
}

@keyframes atom-in {
  to { opacity: 1; }
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

.masthead-text {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.masthead-eyebrow {
  font-family: "Lora", serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: rgba(90, 64, 48, 0.65);
  opacity: 0;
  transform: translateY(8px);
  animation: fade-up 800ms 600ms ease forwards;
}

.masthead-title {
  font-family: "Cormorant Garamond", "Garamond", serif;
  font-weight: 600;
  font-size: clamp(54px, 8.5vw, 110px);
  line-height: 1;
  color: var(--deep-earth);
  letter-spacing: -0.005em;
  display: flex;
  flex-direction: column;
  gap: 0.04em;
}

.title-word {
  opacity: 0;
  transform: translateY(14px);
  animation: fade-up 900ms ease forwards;
}

.title-word:nth-child(1) { animation-delay: 700ms; }
.title-word:nth-child(2) { animation-delay: 950ms; }

.title-word--wiki em {
  font-style: italic;
  font-weight: 400;
  color: var(--teal);
}

.masthead-sub {
  max-width: 48ch;
  font-size: clamp(15px, 1.4vw, 17px);
  line-height: 1.85;
  color: rgba(58, 46, 32, 0.78);
  opacity: 0;
  animation: fade-up 900ms 1100ms ease forwards;
}

.masthead-sub em {
  font-style: italic;
  color: var(--teal);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.08em;
  font-weight: 600;
}

.masthead-fish {
  margin-top: 8px;
  width: 220px;
  opacity: 0;
  animation: fade-up 1100ms 1500ms ease forwards;
}

.masthead-fish svg { width: 100%; height: auto; }

@keyframes fade-up {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- split frame ---------- */
.split-frame {
  display: grid;
  grid-template-columns: minmax(240px, 40%) 1fr;
  gap: 0;
  align-items: start;
  position: relative;
  border-top: 1px solid rgba(90, 64, 48, 0.18);
}

.reference-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sand);
  border-right: 1px solid rgba(90, 64, 48, 0.18);
}

.reference-panel::-webkit-scrollbar {
  width: 6px;
}

.reference-panel::-webkit-scrollbar-thumb {
  background: rgba(90, 64, 48, 0.2);
  border-radius: 3px;
}

.ref-inner {
  padding: 50px clamp(20px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.ref-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(90, 64, 48, 0.18);
}

.ref-mark {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 38px;
  color: var(--teal);
  line-height: 1;
}

.ref-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 28px;
  color: var(--deep-earth);
  letter-spacing: 0.005em;
}

.ref-sub {
  flex: 1 0 100%;
  font-style: italic;
  font-size: 13px;
  color: rgba(90, 64, 48, 0.6);
  margin-top: -4px;
}

.ref-h3 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--umber);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.ref-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-link {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 17px;
  color: var(--umber);
  text-decoration: none;
  padding: 6px 12px;
  margin-left: -12px;
  border-left: 2px solid transparent;
  transition: border-color 400ms ease, color 400ms ease, background 400ms ease;
}

.ref-link:hover {
  color: var(--teal);
  border-left-color: var(--teal);
}

.ref-link.is-active {
  color: var(--deep-earth);
  border-left-color: var(--coral);
  background: rgba(196, 136, 122, 0.08);
  font-style: italic;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Fira Mono", monospace;
  font-size: 13px;
  color: var(--umber);
}

.ref-table td {
  padding: 8px 0;
  border-bottom: 1px dashed rgba(90, 64, 48, 0.18);
}

.ref-table td:first-child { color: rgba(90, 64, 48, 0.7); }
.ref-table td:last-child { text-align: right; color: var(--deep-earth); }

.ref-glyphs {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 8px 0 4px;
}

.ref-glyphs svg { width: 50px; height: 50px; }

.ref-caption {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  color: rgba(90, 64, 48, 0.7);
}

.ref-text {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(58, 46, 32, 0.78);
}

.ref-fish {
  width: 100%;
  height: auto;
  max-width: 220px;
  margin-top: 8px;
}

.ref-foot {
  display: flex;
  gap: 8px;
  font-family: "Fira Mono", monospace;
  font-size: 11px;
  color: rgba(90, 64, 48, 0.55);
  letter-spacing: 0.04em;
  padding-top: 14px;
  border-top: 1px solid rgba(90, 64, 48, 0.12);
  margin-top: 6px;
}

/* ---------- content panel ---------- */
.content-panel {
  padding: 60px clamp(20px, 5vw, 80px) 120px;
  display: flex;
  flex-direction: column;
  gap: 80px;
  max-width: 780px;
}

.article {
  position: relative;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.article.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.article-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(90, 64, 48, 0.2);
}

.article-num {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 28px;
  color: var(--coral);
}

.article-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  color: var(--deep-earth);
  letter-spacing: 0.003em;
}

.article-meta {
  flex: 1 0 100%;
  font-style: italic;
  font-size: 13px;
  color: rgba(90, 64, 48, 0.55);
  font-family: "Lora", serif;
}

.lede {
  font-size: 1.05em;
  margin-bottom: 18px;
  color: var(--deep-earth);
}

.dropcap {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 4em;
  line-height: 0.9;
  float: left;
  padding: 6px 12px 0 0;
  color: var(--teal);
}

.article p {
  margin-bottom: 16px;
}

.article p em {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  color: var(--teal);
  font-size: 1.05em;
}

.article-fig {
  margin: 28px -10px;
  padding: 14px 0;
  border-top: 1px solid rgba(90, 64, 48, 0.18);
  border-bottom: 1px solid rgba(90, 64, 48, 0.18);
}

.article-fig svg {
  width: 100%;
  height: auto;
  max-width: 600px;
  display: block;
  margin: 0 auto;
}

.article-fig figcaption {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  text-align: center;
  color: rgba(90, 64, 48, 0.7);
  margin-top: 10px;
}

.formula {
  display: block;
  font-family: "Fira Mono", monospace;
  font-size: 13px;
  background: rgba(240, 232, 216, 0.6);
  border-left: 2px solid var(--moss);
  padding: 14px 18px;
  margin: 22px 0;
  color: var(--deep-earth);
  white-space: pre-wrap;
  word-spacing: 0.2em;
}

.margin-fish {
  display: block;
  width: 180px;
  opacity: 0.85;
  margin: 20px 0;
}

.margin-fish svg { width: 100%; height: auto; }

.margin-fish--right {
  float: right;
  margin: 4px -40px 14px 18px;
}

.margin-fish--left {
  float: left;
  margin: 4px 18px 14px -40px;
  transform: scaleX(-1);
}

.article-coda {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 18px;
  color: rgba(90, 64, 48, 0.65);
  text-align: center;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px dotted rgba(90, 64, 48, 0.4);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .split-frame { grid-template-columns: 1fr; }
  .reference-panel {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(90, 64, 48, 0.18);
  }
  .content-panel { padding: 50px 20px 100px; max-width: none; }
  .margin-fish--right, .margin-fish--left { float: none; margin: 14px auto; transform: none; }
  .masthead-inner { grid-template-columns: 1fr; text-align: center; }
  .atom-illus { margin: 0 auto; max-width: 240px; }
  .masthead-fish { margin: 8px auto 0; }
  .masthead-title { align-items: center; }
}
