/* ============================================
   Tim McGregor — V2 Stylesheet
   "The Correspondent" — Editorial redesign
   ============================================ */

/* --- Junicode variable font --- */
@font-face {
  font-family: 'Junicode';
  src: url('Junicode/WOFF2/JunicodeVF-Roman.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Junicode';
  src: url('Junicode/WOFF2/JunicodeVF-Italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* --- Colour tokens --- */
:root {
  --bg: #FAF9F6;
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-body: #444;
  --text-muted: #999;
  --accent: #6B4533;
  --accent-light: #F2E8E4;
  --border: #E4E0DA;
  --border-light: #D8D4CE;
}

/* --- Selection --- */
::selection {
  background: rgba(107, 69, 51, 0.15);
}

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

html {
  font-size: 17px;
}

body {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Page wrapper --- */
.page {
  position: relative;
  min-height: 100vh;
}

/* --- Layout --- */
.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 5rem 1.5rem 6rem;
}

/* --- Language toggle --- */
.lang-toggle {
  position: fixed;
  top: 2rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  z-index: 100;
}

.lang-option {
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.25s ease;
  padding: 2px 0;
}

.lang-option:hover {
  color: var(--text-secondary);
}

.lang-option.active {
  color: var(--text);
  font-weight: 500;
}

.lang-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.lang-divider {
  color: var(--border);
  font-weight: 300;
  user-select: none;
}

/* --- Crossfade transition --- */
.translatable {
  transition: opacity 0.3s ease;
}

.translatable.fading {
  opacity: 0;
}

/* --- Japanese text styling --- */
[data-lang="ja"] .bio,
[data-lang="ja"] .section-item,
[data-lang="ja"] .body-text,
[data-lang="ja"] footer {
  font-family: 'Noto Sans JP', sans-serif;
  letter-spacing: 0.04em;
  word-break: auto-phrase;
}

[data-lang="ja"] .bio p,
[data-lang="ja"] .body-text p {
  font-size: 0.88rem;
  line-height: 1.9;
}

[data-lang="ja"] .bio strong,
[data-lang="ja"] .body-text strong {
  font-weight: 500;
}

[data-lang="ja"] .section-item {
  font-size: 0.85rem;
  line-height: 1.8;
}

[data-lang="ja"] h1 {
  font-family: 'Junicode', 'Noto Sans JP', serif;
}

/* --- Header --- */
header {
  margin-bottom: 2.5rem;
}

h1 {
  font-family: 'Junicode', 'Georgia', 'Times New Roman', serif;
  font-size: 2.8rem;
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 1.15;
  text-wrap: balance;
}

h1 .subtitle {
  color: var(--text-secondary);
}

.header-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

.header-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.header-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.header-links a:focus-visible,
.section-item a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Bio / Body text --- */
.bio,
.body-text {
  margin-bottom: 3rem;
}

.bio p,
.body-text p {
  margin-bottom: 1.1rem;
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--text-body);
}

.bio p:last-child,
.body-text p:last-child {
  margin-bottom: 0;
}

.bio strong,
.body-text strong {
  font-weight: 500;
  color: var(--text);
}

/* --- Sections --- */
section {
  margin-bottom: 2.5rem;
  padding-left: 0;
}

section:last-of-type {
  margin-bottom: 0;
}

.section-marker {
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  margin-bottom: 0.6rem;
}

.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.4rem;
}

/* --- Section items --- */
.section-item {
  font-size: 0.9rem;
  line-height: 1.6;
  font-weight: 300;
}

.section-item + .section-item {
  margin-top: 0.2rem;
}

.section-item a {
  color: var(--text);
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.section-item a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Footer --- */
footer {
  margin-top: 4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.globe-icon {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  vertical-align: -2px;
  margin-right: 1px;
}

/* --- Back link (sub-pages) --- */
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.back-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Section divider (sub-pages) --- */
.section-divider {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-top: 0.5rem;
  border-top: 2px solid var(--accent);
  display: inline-block;
}

/* --- Blinking clock colon --- */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.blink-colon {
  animation: blink 1.5s step-end infinite;
}

/* --- Entrance animation --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .container > * {
    animation: fadeIn 0.5s ease-out both;
  }
  .container > *:nth-child(1) { animation-delay: 0s; }
  .container > *:nth-child(2) { animation-delay: 0.06s; }
  .container > *:nth-child(3) { animation-delay: 0.1s; }
  .container > *:nth-child(4) { animation-delay: 0.14s; }
  .container > *:nth-child(5) { animation-delay: 0.18s; }
  .container > *:nth-child(6) { animation-delay: 0.22s; }
  .container > *:nth-child(7) { animation-delay: 0.26s; }

  .lang-toggle {
    animation: fadeIn 0.5s ease-out 0.3s both;
  }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .container { padding: 4rem 1.25rem 4rem; }
  h1 { font-size: 2.3rem; }
  .lang-toggle {
    top: 1.5rem;
    right: 1.25rem;
  }
}
