/* ============================================================
   Sourasis Karak — personal site
   quiet editorial theme · light + dark
   ============================================================ */

:root {
  --bg: #faf9f6;
  --bg-trans: rgba(250, 249, 246, 0.82);
  --text: #1c1b19;
  --muted: #6e6a63;
  --faint: #a29c92;
  --line: #e6e2d9;
  --line-strong: #d5cfc3;
  --accent: #b4552e;
  --accent-soft: rgba(180, 85, 46, 0.10);
  --code-bg: #f1ede5;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wide: 1040px;
  --maxw: 720px;
  --radius: 12px;
}

html[data-theme="dark"] {
  --bg: #151514;
  --bg-trans: rgba(21, 21, 20, 0.82);
  --text: #e9e7e2;
  --muted: #a19d95;
  --faint: #6f6b64;
  --line: #2a2a27;
  --line-strong: #3a3936;
  --accent: #e0825a;
  --accent-soft: rgba(224, 130, 90, 0.12);
  --code-bg: #201f1d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(58% 42% at 50% -8%, var(--accent-soft), transparent 72%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

::selection { background: var(--accent-soft); }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- background motion layer ---------- */
#bg-motion {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

main,
.site-footer { position: relative; z-index: 1; }

/* ---------- scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 100;
  background: transparent;
}
.scroll-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.12s linear;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-trans);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

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

.brand { display: inline-flex; align-items: center; gap: 0.6rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.brand-name { font-family: var(--serif); font-size: 1.05rem; letter-spacing: -0.01em; }

.nav { display: flex; gap: 1.5rem; }
.nav a {
  font-size: 14px;
  color: var(--muted);
  position: relative;
  padding-bottom: 2px;
  transition: color 0.2s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav a:hover { color: var(--text); }
.nav a:hover::after { transform: scaleX(1); }
.nav a.active { color: var(--text); }
.nav a.active::after { transform: scaleX(1); background: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 0.25rem; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }

.menu-btn { display: none; }

.link-btn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.link-btn:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- mobile menu ---------- */
.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 0.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mobile-menu a,
.mobile-menu button {
  padding: 0.7rem 0;
  font-size: 15px;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.mobile-menu a:last-of-type,
.mobile-menu button { border-bottom: none; }
.mobile-menu.open { display: flex; }

/* ---------- hero ---------- */
.hero { padding: 4.5rem 0 1.5rem; }

.hello {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 6vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.4rem;
}

.lede { font-size: 1.1rem; margin: 0 0 1rem; max-width: 64ch; }
.lede + .lede { margin-top: 1rem; }
.lede.muted { color: var(--muted); }

.lede a, .work-desc a, .note-item p a, .now a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.lede a:hover, .work-desc a:hover, .note-item p a:hover, .now a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.75rem;
  font-size: 14px;
}
.hero-links a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.hero-links a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.dot-sep { color: var(--faint); }

.status {
  margin: 1.75rem 0 0;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.status strong { font-weight: 600; color: var(--text); }

.pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(180, 85, 46, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(180, 85, 46, 0); }
  100% { box-shadow: 0 0 0 0 rgba(180, 85, 46, 0); }
}
.clock { color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- now box ---------- */
.now {
  margin: 1rem 0 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.now .eyebrow { display: block; margin-bottom: 0.4rem; }
.now p { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- sections ---------- */
.section { padding: 3.5rem 0; border-top: 1px solid var(--line); margin-top: 3.5rem; }

.eyebrow {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--faint);
}
.section-head { margin-bottom: 1.9rem; }
.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  margin: 0.35rem 0 0;
}

/* ---------- work ---------- */
.work-list { display: flex; flex-direction: column; }
.work-item { padding: 1.6rem 0; border-top: 1px solid var(--line); }
.work-item:first-child { border-top: none; padding-top: 0; }

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.work-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.28rem;
  letter-spacing: -0.01em;
  margin: 0;
}
.flag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  vertical-align: middle;
  margin-left: 0.4rem;
  transform: translateY(-2px);
}
.work-meta {
  font-size: 12.5px;
  color: var(--faint);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.work-sub { margin: 0.35rem 0 0.55rem; color: var(--muted); font-size: 15.5px; }
.work-desc { margin: 0; color: var(--muted); font-size: 15.5px; }
.work-desc strong { color: var(--text); font-weight: 600; }

.work-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.85rem; }
.tag {
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  white-space: nowrap;
}

.work-links { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: 0.9rem; font-size: 13.5px; }
.work-links a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.work-links a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- experience ---------- */
.exp-list { list-style: none; margin: 0; padding: 0; }
.exp-item {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
.exp-item:first-child { border-top: none; padding-top: 0; }
.exp-when { font-size: 12.5px; color: var(--faint); letter-spacing: 0.02em; padding-top: 2px; }
.exp-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0 0 0.15rem;
  letter-spacing: -0.01em;
}
.exp-sep { color: var(--faint); }
.exp-org { margin: 0; font-size: 13px; color: var(--faint); }
.exp-desc { margin: 0.4rem 0 0; font-size: 15px; color: var(--muted); }

.creed { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.creed ul {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
}
.creed li {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text);
  padding-left: 1.1rem;
  position: relative;
  margin-bottom: 0.5rem;
  break-inside: avoid;
}
.creed li::before { content: "—"; position: absolute; left: 0; color: var(--accent); font-style: normal; }

/* ---------- skills ---------- */
.skill-group {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.25rem;
  padding: 1.05rem 0;
  border-top: 1px solid var(--line);
}
.skill-group:first-of-type { border-top: none; padding-top: 0; }
.skill-group h3 { font-family: var(--serif); font-weight: 500; font-size: 1.02rem; margin: 0; letter-spacing: -0.01em; }
.skill-group p { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- notes ---------- */
.note-list { display: flex; flex-direction: column; }
.note-item { display: block; padding: 1.35rem 0; border-top: 1px solid var(--line); transition: opacity 0.2s ease; }
.note-item:first-child { border-top: none; padding-top: 0; }
.note-item:hover { opacity: 0.72; }
.note-meta { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--faint); }
.note-item h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.22rem;
  margin: 0.35rem 0 0.4rem;
  letter-spacing: -0.01em;
}
.note-item p { margin: 0; font-size: 15px; color: var(--muted); }
.note-cta { display: inline-block; margin-top: 0.6rem; font-size: 13.5px; color: var(--accent); }

/* ---------- contact ---------- */
.contact-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.75rem 0 0.5rem;
}
.contact-mail {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 4vw, 1.7rem);
  letter-spacing: -0.01em;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--line-strong);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.contact-mail:hover { color: var(--accent); text-decoration-color: var(--accent); }
.copy-trigger {
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  background: transparent;
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.copy-trigger:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.contact-links { margin-top: 1.5rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; padding: 2rem 0 3rem; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 13.5px;
  color: var(--muted);
}
.footer-right { display: flex; align-items: center; gap: 1.25rem; }
.views { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--faint); }
.views .pulse { width: 6px; height: 6px; }
.views-count { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(20, 19, 18, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal-card {
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 { font-family: var(--serif); font-weight: 500; font-size: 1.05rem; margin: 0; }
.modal-sub { font-size: 12.5px; color: var(--faint); }
.modal-actions { display: flex; align-items: center; gap: 0.5rem; }
.ghost-btn {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--accent); }
.modal-body { overflow: auto; padding: 1rem; background: var(--code-bg); }
.modal-body img { display: block; width: 100%; border-radius: 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.75rem;
  transform: translate(-50%, 1rem);
  z-index: 300;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .nav { display: none; }
  .menu-btn { display: grid; }
  .hero { padding-top: 3.25rem; }
  .section { margin-top: 2.75rem; padding: 2.75rem 0; }
  .section-title { font-size: 1.45rem; }
  .exp-item { grid-template-columns: 1fr; gap: 0.35rem; }
  .exp-when { padding-top: 0; }
  .skill-group { grid-template-columns: 1fr; gap: 0.3rem; }
  .creed ul { columns: 1; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .wrap, .header-inner { padding-left: 1.1rem; padding-right: 1.1rem; }
  .hello { margin-bottom: 1.1rem; }
  .work-head { flex-direction: column; gap: 0.2rem; }
  .work-meta { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .pulse { animation: none; }
  .scroll-progress span { transition: none; }
}
