/* ===========================================================
   Tyson Johnson — Portfolio
   Single stylesheet, no dependencies.
   =========================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --text: #1a1d21;
  --text-soft: #4a5159;
  --text-mute: #6b7280;
  --border: #e3e6ea;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --code-bg: #f2f4f7;
  --max: 760px;
  --max-wide: 1040px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-alt: #161a20;
    --text: #e6e9ee;
    --text-soft: #b6bdc7;
    --text-mute: #8a929d;
    --border: #262b33;
    --accent: #5b9bff;
    --accent-soft: #16263f;
    --code-bg: #1a1f27;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.35);
  }
  img { opacity: 0.94; }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.wrap-wide { max-width: var(--max-wide); }

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--text);
  font-weight: 680;
  letter-spacing: -0.01em;
}

h1 { font-size: 2.4rem; margin: 0 0 0.4em; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; margin: 2.2em 0 0.7em; }
h3 { font-size: 1.15rem; margin: 1.8em 0 0.5em; }

p { margin: 0 0 1.1em; color: var(--text-soft); }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

strong { color: var(--text); font-weight: 650; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.6em 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 5px;
}

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

.site-nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}
.site-nav .brand {
  font-weight: 680;
  color: var(--text);
  letter-spacing: -0.01em;
}
.site-nav .brand:hover { text-decoration: none; }
.site-nav .links a {
  margin-left: 22px;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.site-nav .links a:hover { color: var(--accent); text-decoration: none; }

@media (max-width: 540px) {
  .site-nav .links a { margin-left: 16px; font-size: 0.9rem; }
}

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

.hero {
  padding: 72px 0 56px;
}
.hero .tagline {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 18px;
}
.hero h1 { margin-bottom: 0.35em; }
.hero .intro {
  font-size: 1.18rem;
  color: var(--text-soft);
  max-width: 620px;
}

/* ---------- Sections ---------- */

section { padding: 14px 0; }
.section-lead { color: var(--text-soft); max-width: 620px; }

/* ---------- Project grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 12px;
}
@media (max-width: 680px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--accent);
}
.card h3 { margin: 0 0 0.4em; font-size: 1.2rem; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card .summary { color: var(--text-soft); font-size: 0.97rem; flex: 1; margin-bottom: 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
  font-size: 0.74rem;
  font-weight: 550;
  color: var(--text-mute);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 100px;
}

.card-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.92rem; }
.card-links a { font-weight: 550; }
.card-links .muted { color: var(--text-mute); }

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

.btn-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.96rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn.secondary {
  background: transparent;
  color: var(--accent);
}
.btn.secondary:hover { background: var(--accent-soft); }

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

.contact-list { list-style: none; padding: 0; margin: 12px 0 0; }
.contact-list li { margin-bottom: 8px; color: var(--text-soft); }
.contact-list .label { display: inline-block; min-width: 84px; color: var(--text-mute); font-size: 0.9rem; }

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

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 28px 0;
  color: var(--text-mute);
  font-size: 0.88rem;
}

/* ===========================================================
   Project detail pages
   =========================================================== */

.back-link {
  display: inline-block;
  font-size: 0.92rem;
  color: var(--text-mute);
  margin: 28px 0 4px;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

article { padding-bottom: 40px; }

article .lede {
  font-size: 1.22rem;
  line-height: 1.5;
  color: var(--text-soft);
  margin: 0.2em 0 1.4em;
}

article h1 { margin-top: 0.3em; }

/* At-a-glance list */
article ul { padding-left: 1.3em; margin: 0 0 1.2em; }
article ul li { margin-bottom: 0.4em; color: var(--text-soft); }
article ol { padding-left: 1.4em; }
article ol li { margin-bottom: 0.4em; color: var(--text-soft); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 1.4em 0; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.94rem;
}
th, td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
thead th {
  color: var(--text);
  font-weight: 650;
  border-bottom: 2px solid var(--border);
  background: var(--bg-alt);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
tbody tr:hover { background: var(--bg-alt); }

/* ---------- Figures ---------- */

figure {
  margin: 1.8em 0;
  text-align: center;
}
figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
figcaption {
  font-size: 0.86rem;
  color: var(--text-mute);
  margin-top: 0.7em;
  line-height: 1.5;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* Callout for missing-figure note (kept subtle; mostly figures are HTML comments) */
.note {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text-mute);
  margin: 1.4em 0;
}

/* Hero headshot */
.hero-inner { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.hero-text { flex: 1 1 320px; }
.headshot {
  width: 170px;
  height: 213px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .hero-inner { gap: 20px; }
  .headshot { width: 120px; height: 150px; }
}

/* Language toggle */
.lang-toggle { display:inline-flex; align-items:center; border:1px solid var(--border); border-radius:999px; overflow:hidden; }
.lang-toggle a { padding:3px 11px; font-size:0.8rem; line-height:1.6; color:var(--text-mute); text-decoration:none; }
.lang-toggle a.active { background:var(--accent); color:#fff; }
.lang-toggle a:not(.active):hover { color:var(--text); }

/* Cookie/privacy note */
.cookie-note { max-width: var(--max-wide); margin: 6px auto 0; padding: 0 24px; text-align: center; font-size: 0.72rem; color: var(--text-mute); }

/* Language switch (sliding segmented toggle) */
.lang-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-alt); padding: 2px; font-size: 0.76rem; line-height: 1.6; }
.lang-switch > * { position: relative; z-index: 1; text-align: center; padding: 3px 12px; border-radius: 999px; color: var(--text-mute); text-decoration: none; white-space: nowrap; transition: color .2s; }
.lang-switch::before { content: ""; position: absolute; top: 2px; left: 2px; width: calc(50% - 2px); bottom: 2px; border-radius: 999px; background: var(--accent); transition: transform .2s ease; }
.lang-switch[data-lang="ko"]::before { transform: translateX(100%); }
.lang-switch[data-lang="en"] > :first-child, .lang-switch[data-lang="ko"] > :last-child { color: #fff; font-weight: 600; }
/* Centered footer */
.site-footer { text-align: center; }

/* compact-override: smaller language switch */
.lang-switch { display: inline-grid; vertical-align: middle; margin-left: 22px; padding: 1px; font-size: 0.66rem; }
.lang-switch > * { padding: 2px 8px; }
.lang-switch::before { top: 1px; left: 1px; width: calc(50% - 1px); bottom: 1px; }

/* nav links one-row + tidy mobile wrap */
.site-nav .links { display: flex; align-items: center; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; font-size: 1.5rem; line-height: 1; color: var(--text); padding: 2px 4px; }
@media (max-width: 600px) {
  .nav-toggle { display: inline-flex; align-items: center; min-width: 1.6rem; justify-content: center; }
  .site-nav .wrap { height: 56px; }
  .site-nav .links {
    position: absolute; top: calc(100% + 1px); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow); padding: 6px 0 10px; gap: 0; display: none;
  }
  .site-nav .links.open { display: flex; }
  .site-nav .links a { margin-left: 0; font-size: 1.02rem; color: var(--text); padding: 13px 24px; transition: background .15s, color .15s; }
  .site-nav .links a:hover, .site-nav .links a:active { background: var(--bg-alt); color: var(--accent); text-decoration: none; }
  /* In the hamburger menu: two small rounded rectangles, selected one highlighted (no sliding pill) */
  .site-nav .links .lang-switch { position: static; display: inline-flex; gap: 6px; margin: 12px 24px 4px; padding: 0; background: none; border: none; align-self: flex-start; font-size: 0.78rem; }
  .site-nav .links .lang-switch::before { display: none; }
  .site-nav .links .lang-switch > * { padding: 5px 13px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-alt); color: var(--text-mute); font-weight: 600; }
  .site-nav .links .lang-switch[data-lang="en"] > :first-child,
  .site-nav .links .lang-switch[data-lang="ko"] > :last-child { background: var(--accent); border-color: var(--accent); color: #fff; }
}
