/* ==========================================================================
   Tokyo Kaigan University — design tokens
   Palette:  indigo #1B2A4A (aizome), deep indigo #101B33, washi cream #F2EDE1,
             paper #FAF7F0, vermilion #B23A2E (hanko seal), sumi ink #1A1A1A,
             gold #B8973F (accent line)
   Type:     Shippori Mincho (display / Japanese), Source Serif 4 (English
             prose), Noto Sans JP (UI / body sans), JetBrains Mono (meta)
   Signature: hanko seal roundel + seigaiha wave pattern + vertical nameplate
   ========================================================================== */

:root {
  --indigo: #1b2a4a;
  --indigo-deep: #101b33;
  --cream: #f2ede1;
  --paper: #faf7f0;
  --vermilion: #b23a2e;
  --ink: #1a1a1a;
  --gold: #b8973f;
  --line: rgba(27, 42, 74, 0.14);

  --font-display: "Shippori Mincho", serif;
  --font-body: "Source Serif 4", serif;
  --font-sans: "Noto Sans JP", "Hiragino Sans", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --max-width: 1180px;
  --radius: 2px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

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

:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 2px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vermilion);
  margin: 0 0 0.75rem;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--indigo-deep); margin: 0 0 0.5rem; }
h1 { font-size: clamp(2.1rem, 4.2vw, 3.4rem); line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.25; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1rem; }

.section { max-width: var(--max-width); margin: 0 auto; padding: 4.5rem 1.5rem; }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-bottom: 2.25rem; border-bottom: 1px solid var(--line); padding-bottom: 1.25rem; }
.section__head h2 { flex: 1 1 auto; min-width: 240px; }
.section__link { font-family: var(--font-mono); font-size: 0.82rem; color: var(--indigo); border-bottom: 1px solid var(--gold); padding-bottom: 2px; white-space: nowrap; }

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.site-header { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 1px solid var(--line); }
.site-header__bar { max-width: var(--max-width); margin: 0 auto; padding: 0.9rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }

.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand__seal {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--vermilion); color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
  flex-shrink: 0;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__en { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--indigo-deep); }
.brand__ja { font-family: var(--font-sans); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--vermilion); }

.site-nav { display: flex; align-items: center; gap: 1.9rem; }
.site-nav ul { list-style: none; display: flex; gap: 1.6rem; margin: 0; padding: 0; }
.site-nav a { font-size: 0.92rem; color: var(--indigo); position: relative; padding: 0.3rem 0; }
.site-nav a.is-active { color: var(--vermilion); }
.site-nav a.is-active::after,
.site-nav a:hover::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--vermilion);
}
.nav-cta { flex-shrink: 0; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 0.4rem; }
.nav-toggle span { width: 22px; height: 2px; background: var(--indigo-deep); }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 500;
  padding: 0.7rem 1.5rem; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn--stamp { background: var(--vermilion); color: var(--cream); }
.btn--stamp:hover { background: #952e24; }
.btn--ghost { border-color: var(--indigo); color: var(--indigo); }
.btn--ghost:hover { background: var(--indigo); color: var(--cream); }
.btn--full { width: 100%; margin-top: 1rem; }

/* ---------------------------------------------------------------------- */
/* Hero                                                                    */
/* ---------------------------------------------------------------------- */

.hero {
  position: relative; overflow: hidden;
  background: var(--indigo); color: var(--cream);
}
.hero__pattern {
  position: absolute; inset: 0; opacity: 0.16; pointer-events: none;
  background-image:
    radial-gradient(circle at 50% 120%, transparent 62%, var(--cream) 63%, var(--cream) 66%, transparent 67%),
    radial-gradient(circle at 50% 120%, transparent 72%, var(--cream) 73%, var(--cream) 76%, transparent 77%);
  background-size: 90px 45px;
  background-position: 0 0, 45px 0;
  background-repeat: repeat-x, repeat-x;
  background-position-y: bottom;
  height: 140px; top: auto; bottom: 0;
}
.hero__inner {
  position: relative; max-width: var(--max-width); margin: 0 auto;
  padding: 5.5rem 1.5rem 4rem; display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: start;
}
.hero__copy { max-width: 620px; }
.hero .eyebrow { color: var(--gold); }
.hero h1 { color: var(--cream); }
.hero__lede { font-family: var(--font-body); font-size: 1.08rem; color: rgba(242, 237, 225, 0.82); max-width: 46ch; }
.hero__actions { display: flex; gap: 1rem; margin-top: 1.75rem; flex-wrap: wrap; }
.hero .btn--ghost { border-color: rgba(242, 237, 225, 0.5); color: var(--cream); }
.hero .btn--ghost:hover { background: var(--cream); color: var(--indigo-deep); }

.hero__nameplate {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.3em;
  color: var(--gold);
  border-left: 1px solid rgba(184, 151, 63, 0.4);
  padding-left: 1.5rem;
  opacity: 0.85;
}

.hero__stats {
  position: relative; max-width: var(--max-width); margin: 0 auto;
  padding: 0 1.5rem 3.5rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem;
}
.stat { border-top: 1px solid rgba(242, 237, 225, 0.25); padding-top: 0.85rem; display: flex; flex-direction: column; }
.stat__value { font-family: var(--font-display); font-size: 1.8rem; color: var(--cream); }
.stat__label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(242, 237, 225, 0.65); }

/* ---------------------------------------------------------------------- */
/* Faculty grid                                                            */
/* ---------------------------------------------------------------------- */

.faculty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.faculty-card { background: var(--paper); padding: 1.75rem; display: flex; flex-direction: column; gap: 0.35rem; transition: background 0.15s ease; }
.faculty-card:hover { background: var(--cream); }
.faculty-card__ja { font-family: var(--font-display); font-size: 1.3rem; color: var(--vermilion); }
.faculty-card__en { font-family: var(--font-sans); font-weight: 600; color: var(--indigo-deep); }
.faculty-card__desc { font-size: 0.86rem; color: #4a4a4a; margin-top: 0.35rem; }

/* ---------------------------------------------------------------------- */
/* Research cards                                                          */
/* ---------------------------------------------------------------------- */

.research-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.research-grid--full { grid-template-columns: repeat(3, 1fr); }
.research-card {
  border: 1px solid var(--line); background: var(--paper); padding: 1.6rem;
  display: flex; flex-direction: column; gap: 0.5rem; position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.research-card:hover { border-color: var(--vermilion); transform: translateY(-2px); }
.research-card__figure {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--gold);
  border: 1px solid var(--gold); border-radius: 50%; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.research-card__tag { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vermilion); }
.research-card h3 { font-size: 1.08rem; line-height: 1.35; margin: 0.15rem 0 0.25rem; }
.research-card p { font-size: 0.9rem; color: #4a4a4a; margin-bottom: 0.5rem; }
.research-card__meta { margin-top: auto; font-family: var(--font-mono); font-size: 0.72rem; color: #6b6b6b; }

/* ---------------------------------------------------------------------- */
/* News list                                                               */
/* ---------------------------------------------------------------------- */

.news-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.news-list li { border-bottom: 1px solid var(--line); }
.news-list a { display: grid; grid-template-columns: 110px 1fr auto; gap: 1.25rem; align-items: center; padding: 1.1rem 0.25rem; }
.news-list a:hover .news-list__title { color: var(--vermilion); }
.news-list__date { font-family: var(--font-mono); font-size: 0.78rem; color: #6b6b6b; }
.news-list__title { font-family: var(--font-body); font-size: 1rem; color: var(--indigo-deep); transition: color 0.15s ease; }
.news-list__cat { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold); padding: 0.2rem 0.5rem; white-space: nowrap; }

/* ---------------------------------------------------------------------- */
/* Page header (interior pages)                                            */
/* ---------------------------------------------------------------------- */

.page-header { max-width: var(--max-width); margin: 0 auto; padding: 4rem 1.5rem 2rem; border-bottom: 1px solid var(--line); }
.page-header__lede { font-family: var(--font-body); font-size: 1.05rem; color: #4a4a4a; max-width: 60ch; }
.not-found { text-align: center; border-bottom: none; padding-bottom: 4rem; }
.not-found .btn { margin-top: 1.5rem; }

/* ---------------------------------------------------------------------- */
/* Prose sections (about, admissions)                                      */
/* ---------------------------------------------------------------------- */

.prose-section { display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; align-items: start; }
.prose { font-family: var(--font-body); font-size: 1.02rem; color: #2c2c2c; }
.prose h2 { margin-top: 2rem; }
.prose h2:first-child { margin-top: 0; }

.fact-panel { background: var(--cream); border: 1px solid var(--line); padding: 1.75rem; position: sticky; top: 90px; }
.fact-panel h3 { font-size: 0.95rem; margin-bottom: 1rem; }
.fact-panel dl { margin: 0; }
.fact-panel dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); font-size: 0.88rem; }
.fact-panel dl > div:last-child { border-bottom: none; }
.fact-panel dt { color: #6b6b6b; }
.fact-panel dd { margin: 0; text-align: right; color: var(--indigo-deep); font-weight: 500; }

/* ---------------------------------------------------------------------- */
/* Faculty list (academics page)                                           */
/* ---------------------------------------------------------------------- */

.faculty-list { display: flex; flex-direction: column; }
.faculty-row {
  display: grid; grid-template-columns: 60px 1fr 2fr auto; gap: 1.5rem; align-items: center;
  padding: 1.75rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 100px;
}
.faculty-row__num { font-family: var(--font-mono); color: var(--gold); font-size: 1rem; }
.faculty-row__name h2 { margin: 0; }
.faculty-row__ja { font-family: var(--font-display); color: var(--vermilion); font-size: 0.95rem; }
.faculty-row__desc { color: #4a4a4a; font-size: 0.92rem; margin: 0; }
.faculty-row__link { font-family: var(--font-mono); font-size: 0.78rem; color: var(--indigo); border-bottom: 1px solid var(--gold); white-space: nowrap; padding-bottom: 2px; }

/* ---------------------------------------------------------------------- */
/* Article (research-detail, news-detail)                                  */
/* ---------------------------------------------------------------------- */

.article { max-width: 840px; margin: 0 auto; padding: 4rem 1.5rem 5rem; }
.article__back { font-family: var(--font-mono); font-size: 0.78rem; color: var(--indigo); display: inline-block; margin-bottom: 1.5rem; }
.article__meta { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); font-size: 0.82rem; color: #6b6b6b; margin: 1rem 0; }
.article__meta-dot { color: var(--gold); }
.article__excerpt { font-family: var(--font-body); font-size: 1.15rem; color: #3a3a3a; border-left: 3px solid var(--vermilion); padding-left: 1rem; margin-top: 1.25rem; }
.article__figure {
  margin: 2.5rem 0; height: 180px; background: var(--indigo);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}
.article__figure span { font-family: var(--font-display); font-size: 3rem; color: var(--gold); }
.article__body { font-family: var(--font-body); font-size: 1.05rem; color: #2c2c2c; }
.article__body p { margin-bottom: 1.25rem; }

.related { margin-top: 3.5rem; border-top: 1px solid var(--line); padding-top: 2rem; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.related-card { border: 1px solid var(--line); padding: 1.1rem; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.9rem; }
.related-card:hover { border-color: var(--vermilion); }
.related-card__figure { font-family: var(--font-mono); font-size: 0.72rem; color: var(--gold); }

/* ---------------------------------------------------------------------- */
/* Admissions timeline                                                     */
/* ---------------------------------------------------------------------- */

.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.timeline__item { display: flex; gap: 0.9rem; align-items: flex-start; }
.timeline__stamp {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
  background: var(--vermilion); color: var(--cream); font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.timeline__item h3 { font-size: 0.98rem; margin-bottom: 0.15rem; }
.timeline__item p { font-family: var(--font-mono); font-size: 0.8rem; color: #6b6b6b; margin: 0; }

/* ---------------------------------------------------------------------- */
/* Contact                                                                  */
/* ---------------------------------------------------------------------- */

.contact-section { display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; align-items: start; }
.contact-form { display: flex; flex-direction: column; gap: 1.1rem; }
.form-row { display: flex; flex-direction: column; gap: 0.4rem; }
.form-row label { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--indigo); }
.form-row input, .form-row select, .form-row textarea {
  font-family: var(--font-sans); font-size: 0.95rem; padding: 0.7rem 0.85rem;
  border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--vermilion); }
.contact-form .btn { align-self: flex-start; }

/* ---------------------------------------------------------------------- */
/* Footer                                                                   */
/* ---------------------------------------------------------------------- */

.site-footer { background: var(--indigo-deep); color: rgba(242, 237, 225, 0.85); margin-top: 5rem; position: relative; }
.site-footer__wave {
  height: 10px;
  background: repeating-linear-gradient(90deg, var(--vermilion) 0 40px, var(--gold) 40px 80px);
  opacity: 0.85;
}
.site-footer__grid { max-width: var(--max-width); margin: 0 auto; padding: 3.5rem 1.5rem 2rem; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 2rem; }
.footer-col h3 { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin-bottom: 1rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.9rem; }
.footer-col a:hover { color: var(--cream); }
.footer-col address { font-style: normal; font-size: 0.9rem; line-height: 1.8; }
.footer-col--brand .brand__seal--footer { width: 44px; height: 44px; font-size: 1.3rem; margin-bottom: 1rem; }
.footer-name { font-family: var(--font-display); font-size: 1.1rem; color: var(--cream); margin: 0 0 0.75rem; }
.footer-name__ja { font-size: 0.85rem; color: var(--gold); }
.footer-motto { font-family: var(--font-body); font-style: italic; font-size: 0.9rem; color: rgba(242, 237, 225, 0.6); }
.site-footer__bottom {
  max-width: var(--max-width); margin: 0 auto; padding: 1.5rem 1.5rem 2rem;
  border-top: 1px solid rgba(242, 237, 225, 0.12);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.72rem; color: rgba(242, 237, 225, 0.55);
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */

@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__nameplate { writing-mode: horizontal-tb; border-left: none; padding-left: 0; letter-spacing: 0.15em; font-size: 1.1rem; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); }
  .faculty-grid { grid-template-columns: repeat(2, 1fr); }
  .research-grid, .research-grid--full { grid-template-columns: repeat(2, 1fr); }
  .prose-section, .contact-section { grid-template-columns: 1fr; }
  .fact-panel { position: static; }
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: 1fr; }
  .faculty-row { grid-template-columns: 40px 1fr; }
  .faculty-row__desc, .faculty-row__link { grid-column: 2; }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--paper);
    border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch;
    padding: 1rem 1.5rem 1.5rem; display: none; gap: 1rem;
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; gap: 0.9rem; }
  .faculty-grid, .research-grid, .research-grid--full { grid-template-columns: 1fr; }
  .news-list a { grid-template-columns: 1fr; gap: 0.35rem; }
  .timeline { grid-template-columns: 1fr; }
  .section { padding: 3rem 1.25rem; }
}

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