/* ==========================================================================
   Fagopyrum — journal website styles
   Palette inspired by a buckwheat field: deep foliage green, warm paper,
   golden grain, and the white-pink of buckwheat blossom.
   ========================================================================== */

:root {
  --paper:    #f6f3ea;
  --paper-2:  #efe9da;
  --surface:  #ffffff;
  --ink:      #20261d;
  --ink-2:    #56604f;
  --ink-3:    #828b7c;

  --green:    #2e5d3b;
  --green-2:  #234a2e;
  --green-3:  #4d8a5e;
  --gold:     #b08a3e;
  --gold-2:   #caa861;
  --blossom:  #ead9d6;

  --line:     rgba(32, 38, 29, .12);
  --line-2:   rgba(32, 38, 29, .07);

  --sh-1: 0 1px 2px rgba(20, 30, 18, .06), 0 1px 3px rgba(20, 30, 18, .05);
  --sh-2: 0 6px 18px rgba(20, 30, 18, .08), 0 2px 6px rgba(20, 30, 18, .06);
  --sh-3: 0 18px 40px rgba(20, 30, 18, .16), 0 6px 14px rgba(20, 30, 18, .10);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --wrap: 1180px;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; color: var(--ink); margin: 0; }
a { color: var(--green); text-decoration-color: rgba(46, 93, 59, .35); text-underline-offset: 2px; }
a:hover { color: var(--green-2); }
img { display: block; max-width: 100%; }

.wrap { width: min(var(--wrap), calc(100% - 2.5rem)); margin-inline: auto; }

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .74rem;
  font-weight: 700;
  color: var(--gold);
}

.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section--alt { background: linear-gradient(180deg, var(--paper-2), var(--paper)); border-block: 1px solid var(--line-2); }
.section__head { max-width: 720px; margin-bottom: 2.2rem; }
.section__head h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin: .35rem 0 .5rem; }
.section__head p { color: var(--ink-2); font-size: 1.05rem; margin: 0; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 600 .95rem/1 var(--sans);
  padding: .8rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--green); color: #fff; box-shadow: var(--sh-1); }
.btn--primary:hover { background: var(--green-2); color: #fff; box-shadow: var(--sh-2); }
.btn--ghost { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.5); }
.btn--ghost:hover { background: rgba(255,255,255,.22); color:#fff; }
.btn--outline { background: var(--surface); color: var(--green); border-color: var(--line); box-shadow: var(--sh-1); }
.btn--outline:hover { border-color: var(--green-3); }

/* ---- Header ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 243, 234, .82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-2);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
.brand__name { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; letter-spacing: .01em; }

.nav { display: flex; align-items: center; gap: .35rem; }
.nav a {
  font: 600 .92rem/1 var(--sans);
  color: var(--ink-2); text-decoration: none;
  padding: .55rem .8rem; border-radius: 8px;
}
.nav a:hover { color: var(--green); background: rgba(46,93,59,.07); }
.nav__cta { color: #fff !important; background: var(--green); }
.nav__cta:hover { background: var(--green-2) !important; }

.nav-toggle {
  display: none;
  width: 42px; height: 42px; flex: none;
  align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* ---- Hero -------------------------------------------------------------- */
.hero { position: relative; color: #fff; overflow: hidden; }
.hero__bg {
  position: absolute; inset: 0;
  background: var(--green-2) url("../img/hero.jpg") center 35% / cover no-repeat;
}
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(20,40,24,.55) 0%, rgba(20,40,24,.30) 40%, rgba(18,36,22,.82) 100%),
    linear-gradient(90deg, rgba(15,32,19,.65), rgba(15,32,19,.05));
}
.hero__inner { position: relative; padding: clamp(3.4rem, 9vw, 6.5rem) 0 clamp(2.6rem, 6vw, 4rem); }
.hero__content { max-width: 660px; }
.hero h1 {
  color: #fff; font-size: clamp(2.8rem, 8vw, 5rem); line-height: .98;
  letter-spacing: .005em; margin: 0 0 .5rem;
  text-shadow: 0 2px 24px rgba(0,0,0,.25);
}
.hero__tag { font-family: var(--serif); font-style: italic; font-size: clamp(1.1rem, 2.6vw, 1.5rem); color: #f1ecd9; margin: 0 0 1.4rem; }
.hero__meta { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: 0 0 1.8rem; padding: 0; list-style: none; color: #e7ecdf; font-size: .92rem; }
.hero__meta li { display: inline-flex; align-items: center; gap: .45rem; }
.hero__meta b { color: var(--gold-2); font-weight: 700; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.hero__strip { position: relative; background: rgba(13,28,17,.55); border-top: 1px solid rgba(255,255,255,.12); }
.hero__strip .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; padding: 1rem 0; }
.stat { display: flex; align-items: baseline; gap: .5rem; color: #e9eee1; font-size: .9rem; }
.stat b { font-family: var(--serif); font-size: 1.5rem; color: #fff; line-height: 1; }

/* ---- Archive controls -------------------------------------------------- */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-bottom: 1.6rem; }
.search {
  position: relative; flex: 1 1 260px; min-width: 220px;
}
.search input {
  width: 100%; font: 500 .98rem var(--sans); color: var(--ink);
  padding: .72rem .9rem .72rem 2.4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--sh-1); outline: none;
}
.search input:focus { border-color: var(--green-3); box-shadow: 0 0 0 3px rgba(77,138,94,.18); }
.search svg { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font: 600 .86rem var(--sans); color: var(--ink-2);
  padding: .5rem .85rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
  transition: all .14s ease;
}
.chip:hover { border-color: var(--green-3); color: var(--green); }
.chip[aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); }

.sort { margin-left: auto; display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: .88rem; }
.sort select {
  font: 600 .86rem var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem 1.8rem .45rem .65rem; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2356604f' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .55rem center;
}
.result-count { color: var(--ink-3); font-size: .88rem; margin: 0 0 1.4rem; }

/* ---- Era groups + grid ------------------------------------------------- */
.era-group { margin-bottom: 2.8rem; }
.era-group__head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; padding-bottom: .7rem; margin-bottom: 1.3rem; border-bottom: 1px solid var(--line); }
.era-group__head h3 { font-size: 1.32rem; }
.era-group__head .era-years { color: var(--gold); font-weight: 700; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; }
.era-group__head p { width: 100%; color: var(--ink-2); font-size: .93rem; margin: .1rem 0 0; max-width: 70ch; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 1.4rem 1.3rem;
}

.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: inherit;
  box-shadow: var(--sh-1);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--line); }
.card:focus-visible { outline: 3px solid var(--green-3); outline-offset: 2px; }

.card__cover {
  position: relative;
  aspect-ratio: 1 / 1.32;
  display: grid; place-items: center;
  padding: 14px 14px 0;
  background: linear-gradient(170deg, #fbfaf5, #ece6d7);
}
.card__cover img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border: 1px solid rgba(0,0,0,.10);
  box-shadow: 0 6px 14px rgba(20,30,18,.18);
  background: #fff;
}
.card__cover .ph { /* placeholder when no cover */
  width: 78%; aspect-ratio: 1/1.4; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); color: var(--ink-3);
  font-family: var(--serif); font-size: .8rem; text-align: center; padding: 1rem;
}
.badge {
  position: absolute; top: 10px; right: 10px;
  font: 700 .64rem/1 var(--sans); letter-spacing: .08em;
  color: #fff; background: rgba(32,38,29,.72); backdrop-filter: blur(3px);
  padding: .32rem .5rem; border-radius: 6px;
}
.badge--suppl { background: var(--gold); }

.card__body { padding: .8rem .9rem 1rem; border-top: 1px solid var(--line-2); }
.card__title { font-family: var(--serif); font-size: 1.04rem; font-weight: 600; }
.card__sub { color: var(--ink-2); font-size: .82rem; margin-top: .15rem; }
.card__meta { display: flex; align-items: center; gap: .5rem; margin-top: .55rem; color: var(--ink-3); font-size: .76rem; }
.card__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.card__open { margin-top: .6rem; display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .82rem; color: var(--green); }
.card:hover .card__open { color: var(--green-2); }
.card__open svg { width: 14px; height: 14px; }

.empty { text-align: center; color: var(--ink-2); padding: 3rem 1rem; font-size: 1.05rem; }

/* ---- About ------------------------------------------------------------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: start; }
.prose p { color: var(--ink-2); font-size: 1.05rem; margin: 0 0 1rem; max-width: 62ch; }
.prose p:first-child { font-size: 1.12rem; color: var(--ink); }

.eras { display: grid; gap: .9rem; margin-top: 1.8rem; }
.era-card { background: var(--surface); border: 1px solid var(--line-2); border-left: 3px solid var(--green-3); border-radius: 10px; padding: 1rem 1.15rem; box-shadow: var(--sh-1); }
.era-card h4 { font-size: 1.05rem; }
.era-card .yrs { color: var(--gold); font-weight: 700; font-size: .8rem; letter-spacing: .05em; }
.era-card p { color: var(--ink-2); font-size: .92rem; margin: .4rem 0 0; }

.colophon { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--sh-2); position: sticky; top: 84px; }
.colophon h3 { font-size: 1.2rem; margin-bottom: 1rem; }
.colophon dl { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; margin: 0 0 1.2rem; }
.colophon dt { color: var(--ink-3); font-size: .82rem; font-weight: 600; }
.colophon dd { margin: 0; font-size: .9rem; color: var(--ink); }
.colophon .board { border-top: 1px solid var(--line); padding-top: 1rem; }
.colophon .board h4 { font-family: var(--sans); text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--ink-3); margin-bottom: .55rem; }
.colophon .board ul { margin: 0; padding-left: 1.05rem; }
.colophon .board li { font-size: .9rem; color: var(--ink-2); margin-bottom: .25rem; }
.colophon .board li b { color: var(--ink); }

/* ---- Symposia timeline ------------------------------------------------- */
.timeline { position: relative; margin-top: 1rem; }
.timeline::before { content: ""; position: absolute; left: 22px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--green-3), var(--blossom)); }
.event { position: relative; padding: 0 0 1.7rem 64px; }
.event:last-child { padding-bottom: 0; }
.event__num {
  position: absolute; left: 0; top: 0;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--green-3); color: var(--green);
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem; box-shadow: var(--sh-1);
}
.event__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; }
.event__head h3 { font-size: 1.12rem; }
.event__year { color: var(--gold); font-weight: 700; }
.event__loc { color: var(--ink-2); font-size: .95rem; margin: .15rem 0 .1rem; }
.event__org { color: var(--ink-3); font-size: .86rem; }
.event__note { color: var(--ink-2); font-size: .9rem; margin-top: .4rem; max-width: 70ch; }
.event__media { margin: .9rem 0 0; max-width: 580px; }
.event__media img {
  width: 100%; height: auto; display: block;
  border-radius: 10px; border: 1px solid var(--line);
  box-shadow: var(--sh-1); background: var(--surface);
}

/* ---- Footer ------------------------------------------------------------ */
.site-footer { background: var(--green-2); color: #dfe7d8; padding: 3rem 0 2rem; margin-top: 1rem; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem; }
.site-footer h4 { color: #fff; font-family: var(--sans); text-transform: uppercase; letter-spacing: .1em; font-size: .74rem; margin-bottom: .9rem; }
.site-footer .brand__name { color: #fff; }
.footer-about { font-size: .92rem; max-width: 40ch; margin: .9rem 0 0; color: #cdd8c4; }
.footer-list { list-style: none; margin: 0; padding: 0; }
.footer-list li { margin-bottom: .5rem; font-size: .92rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.16); margin-top: 2.2rem; padding-top: 1.3rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; font-size: .82rem; color: #b9c6ae; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .colophon { position: static; }
  .footer-grid { grid-template-columns: 1fr; }

  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: .15rem;
    background: var(--paper); border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-2); padding: .6rem 1rem 1rem;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: .8rem .7rem; border-radius: 8px; }
  .nav__cta { text-align: center; margin-top: .35rem; }
}
@media (max-width: 540px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1.1rem .9rem; }
  .sort { margin-left: 0; width: 100%; }
  .hero__meta { font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
