/* ===== Watanabe Group — Stylesheet ===== */
/* Fonts: Arial (Latin) + Noto Sans JP / Hiragino / Yu Gothic (Japanese)
 * Noto Sans JP is loaded via <link> in each HTML <head>. */

:root {
  /* Layout */
  --max-width: 920px;

  /* Colors — white base + steel blue (matching textbook covers) */
  --bg: #ffffff;
  --bg-soft: #f4f7fa;
  --bg-tint: #edf3f8;
  --bg-elevated: #ffffff;

  --text: #1a1a1a;
  --text-strong: #0a0a0a;
  --text-light: #3a3a3a;
  --muted: #6a727b;
  --muted-soft: #a3aab2;

  --accent: #3a7ca5;          /* steel blue */
  --accent-hover: #1f5d83;    /* deep steel blue */
  --accent-deep: #1a4a6c;
  --accent-soft: #dee8f0;
  --accent-tint: #f0f5f9;
  --accent-border: #b9cedb;

  --border: #d8dfe6;
  --border-soft: #e5eaef;

  --danger: #b00020;
  --danger-hover: #800018;
  --success: #1d7a1d;

  --shadow-sm: 0 1px 2px rgba(58, 124, 165, 0.06);
  --shadow-md: 0 4px 16px rgba(58, 124, 165, 0.08);
  --shadow-lg: 0 12px 32px rgba(58, 124, 165, 0.12);

  --radius: 4px;
  --radius-lg: 8px;

  --font-sans: Arial, "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", Meiryo, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
*::selection { background: var(--accent); color: #fff; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.78;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Links ===== */
a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(to right, var(--accent), var(--accent));
  background-position: 0 100%;
  background-size: 0% 1px;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease, color 0.2s ease;
  padding-bottom: 1px;
}
a:hover {
  background-size: 100% 1px;
  color: var(--accent-hover);
}

/* ===== Header (steel-blue band, white text — matches book covers) ===== */
header.site-header {
  background: var(--accent);
  border-bottom: 1px solid var(--accent-deep);
  padding: 1.1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(26, 74, 108, 0.18);
}

header.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

header.site-header .site-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: #ffffff;
}
header.site-header .site-title a {
  color: #ffffff;
  background: none;
  text-decoration: none;
  padding: 0;
  transition: opacity 0.2s ease;
}
header.site-header .site-title a:hover {
  color: #ffffff;
  opacity: 0.8;
  background: none;
}

header.site-header nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

header.site-header nav a {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  background: none;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
header.site-header nav a:hover {
  color: #ffffff;
  border-bottom-color: #ffffff;
  background: none;
  background-size: 0;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

/* ===== Page hero (decorative banner — index page) ===== */
.page-hero {
  position: relative;
  height: clamp(220px, 38vh, 420px);
  background: url("office.jpg") no-repeat center 45% / cover;
  overflow: hidden;
}
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(30, 58, 95, 0.18) 0%,
    rgba(255, 255, 255, 0.0) 30%,
    rgba(255, 255, 255, 0.5) 75%,
    rgba(255, 255, 255, 1) 100%
  );
}
.page-hero + main { padding-top: 2.5rem; }

/* ===== Headings ===== */
h1 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin: 0 0 1.5rem;
  color: var(--text-strong);
}
h1::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  background: var(--accent);
  margin-top: 1.25rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 3.5rem 0 1.25rem;
  padding-bottom: 0.6rem;
  color: var(--text-strong);
  letter-spacing: 0.005em;
  border-bottom: 1px solid var(--border);
  position: relative;
  clear: right;
}
h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 3rem;
  height: 2px;
  background: var(--accent);
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.85rem 0 0.65rem;
  color: var(--text-strong);
  letter-spacing: 0.015em;
}

p, ul, ol { margin: 0.75rem 0 1.25rem; }
ul, ol { padding-left: 1.5rem; }
ul li::marker { color: var(--accent); }
ul li, ol li { padding-left: 0.25rem; margin-bottom: 0.2rem; }
li ul, li ol { margin: 0.4rem 0 0.6rem; }

hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 3rem auto;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

code {
  font-family: var(--font-mono);
  background: var(--accent-tint);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  font-size: 0.92em;
  color: var(--accent-deep);
}

.book-cover {
  float: right;
  max-width: 200px;
  margin: 0 0 1rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.youtube-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-width: 720px;
  margin: 1.25rem auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  background: #000;
}

.award-figure {
  margin: 2rem auto;
  text-align: center;
}
.award-figure img {
  max-width: 200px;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
}
.award-figure figcaption {
  margin-top: 0.85rem;
  font-size: 0.92rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}
.youtube-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.profile-photo {
  float: right;
  width: 170px;
  aspect-ratio: 4 / 5;
  margin: 0.25rem 0 1rem 1.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.research-figure {
  float: right;
  width: 320px;
  margin: 0.4rem 0 1rem 1.75rem;
  text-align: center;
}
.research-figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: block;
}
.research-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  text-align: left;
}
@media (max-width: 720px) {
  .research-figure {
    float: none;
    width: 100%;
    max-width: 480px;
    margin: 1rem auto 1.5rem;
  }
}
.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}

/* ===== Buttons ===== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  letter-spacing: 0.02em;
  background-image: none;
  font-family: var(--font-sans);
}
.button:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background-size: 0;
  background-image: none;
}
.button:disabled {
  background: var(--muted-soft);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.button.secondary:hover {
  background: var(--accent);
  color: #fff;
}

/* ===== Career table ===== */
table.career {
  border-collapse: collapse;
  margin: 1.25rem 0 2rem;
  width: 100%;
}
table.career th,
table.career td {
  vertical-align: top;
  padding: 0.95rem 0.5rem 0.95rem 0;
  border-bottom: 1px solid var(--border-soft);
}
table.career th {
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
  width: 1%;
  padding-right: 2.25rem;
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
table.career td { color: var(--text); }
table.career tr { transition: background 0.15s ease; }
table.career tr:hover { background: var(--accent-tint); }
table.career tr:last-child th,
table.career tr:last-child td { border-bottom: none; }

@media (max-width: 600px) {
  table.career, table.career tbody, table.career tr,
  table.career th, table.career td { display: block; width: 100%; }
  table.career tr {
    border-bottom: 1px solid var(--border-soft);
    padding: 0.6rem 0;
  }
  table.career tr:last-child { border-bottom: none; }
  table.career th {
    padding: 0;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  table.career td { padding: 0.25rem 0 0; border-bottom: none; }
}

/* ===== Footer ===== */
footer.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

/* ===== Bulletin board ===== */
.board {
  margin-top: 3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.board h2 {
  margin-top: 0;
  border-bottom-color: var(--border-soft);
}

.board-form label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 1rem 0 0.4rem;
  color: var(--text-strong);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-form input[type="text"],
.board-form textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.board-form textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.7;
}

.board-form input[type="text"]:focus,
.board-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58, 124, 165, 0.15);
}

.board-form .hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.board-form .form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.board-status {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.board-status.error { color: var(--danger); }
.board-status.ok { color: var(--success); }

.posts {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.1rem 1.5rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.post:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--accent-border);
}
.post::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
  gap: 0.75rem;
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}
.post-header .handle {
  font-weight: 700;
  color: var(--text-strong);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.post-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.75;
  color: var(--text);
}
.post-body .katex { font-size: 1.05em; }
.post-body .katex-display { margin: 0.6em 0; }

.post-empty {
  color: var(--muted);
  padding: 2.5rem 1rem;
  text-align: center;
  font-style: italic;
  background: var(--bg-soft);
  border-radius: var(--radius);
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ===== Admin ===== */
.admin-post .delete-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}
.admin-post .delete-btn:hover { background: var(--danger-hover); }
.admin-post.deleted { opacity: 0.4; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.25rem; margin-top: 2.5rem; }
  main { padding: 2rem 1rem 3rem; }
  .board { padding: 1.5rem 1.25rem; border-radius: var(--radius); }
  header.site-header { padding: 0.75rem 1rem; }
  header.site-header nav { gap: 1rem; }
  header.site-header nav a { font-size: 0.88rem; }
  .book-cover { float: none; display: block; margin: 0 auto 1rem; max-width: 220px; }
  .profile-photo { float: none; margin: 0 auto 1.5rem; width: 100%; max-width: 240px; }
}
