/* ========================================
   Editor Surface Theme
   Light/Dark mode via [data-theme] on <html>
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  --font-sans: "Inter", "Raleway", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;

  --max-width: 900px;
  --content-padding: 5%;

  --accent: #cc6600;
  --accent-hover: #e07000;
  --accent-secondary: #2dd4bf;

  --transition-fast: 100ms ease;
  --transition-med: 200ms ease;
  --transition-slow: 300ms ease;
}

/* Light theme (default) */
[data-theme="light"], :root {
  --bg: #fafafa;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0f0f0;
  --bg-code: #f4f4f5;
  --text: #1e1e1e;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --border: #e5e5e5;
  --border-active: var(--accent);
  --gutter-color: #d4d4d8;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #1e1e1e;
  --bg-surface: #252526;
  --bg-surface-hover: #2d2d30;
  --bg-code: #2d2d30;
  --text: #d4d4d4;
  --text-muted: #858585;
  --text-faint: #555555;
  --border: #3e3e42;
  --border-active: var(--accent);
  --gutter-color: #3e3e42;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* --- Reset (minimal) --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Base --- */
html {
  font-size: 62.5%;
  scroll-behavior: smooth;
  overflow-y: scroll;
}

body {
  font-family: var(--font-sans);
  font-size: 1.7rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color var(--transition-med), color var(--transition-med);
  -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 {
  font-size: 3.6rem;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
}

h2 {
  font-size: 2.6rem;
  margin-top: 3.2rem;
  margin-bottom: 1.6rem;
}

h3 {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}

h4 {
  font-size: 1.8rem;
  margin-bottom: 0.6rem;
}

p {
  font-size: 1.7rem;
  line-height: 1.7;
  margin-bottom: 1.6rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

strong, b {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-code);
  padding: 0.2em 0.5em;
  border-radius: 4px;
  transition: background-color var(--transition-med);
}

pre {
  background: var(--bg-code);
  padding: 2rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border);
  transition: background-color var(--transition-med), border-color var(--transition-med);
}

pre code {
  background: none;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1.6;
}

ul, ol {
  margin: 0.8rem 0 1.6rem 2.4rem;
  font-size: 1.7rem;
  line-height: 1.7;
}

ul {
  list-style: disc;
}

ol {
  list-style: decimal;
}

li {
  margin-bottom: 0.6rem;
  font-size: 1.7rem;
}

/* --- Layout --- */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--content-padding);
}

/* --- Tab Bar (Header) --- */
.tab-bar {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  gap: 0;
  transition: border-color var(--transition-med);
}

.tab-bar .logo-tab {
  display: flex;
  align-items: center;
  padding: 1.2rem 2rem 1.2rem 0;
  border-right: 1px solid var(--border);
  transition: border-color var(--transition-med);
}

.tab-bar .logo-tab a {
  display: flex;
  align-items: center;
}

.tab-bar .logo-tab img {
  height: 32px;
  width: auto;
  transition: transform var(--transition-med);
}

.tab-bar .logo-tab img:hover {
  transform: scale(1.08);
}

/* Kappa logo shimmer on hover */
.tab-bar .logo-tab a:hover img {
  filter: drop-shadow(0 0 6px rgba(204, 102, 0, 0.5));
}

.tab-bar nav {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.tab-bar nav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 1.2rem 2rem;
  font-size: 1.5rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

.tab-bar nav a:hover {
  color: var(--text);
  background-color: var(--bg-surface-hover);
}

.tab-bar nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background-color: var(--bg-surface);
}

.tab-bar .spacer {
  flex: 1;
}

.tab-bar .theme-toggle {
  display: flex;
  align-items: center;
  padding: 1.2rem 0.8rem;
}

#theme-toggle {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 2.2rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  line-height: 1;
  transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

#theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: var(--bg-surface-hover);
}

/* --- Gutter --- */
.editor-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.gutter {
  width: 48px;
  flex-shrink: 0;
  padding-top: 3.2rem;
  text-align: right;
  padding-right: 1.2rem;
  border-right: 1px solid var(--border);
  user-select: none;
  transition: border-color var(--transition-med);
}

.gutter-line {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  line-height: 2.8rem;
  color: var(--gutter-color);
}

.content-area {
  flex: 1;
  padding: 3.2rem 0 6rem 3.2rem;
  max-width: var(--max-width);
  min-width: 0;
}

@media (max-width: 700px) {
  .gutter {
    display: none;
  }
  .content-area {
    padding: 2.4rem 0 4rem 0;
  }
}

/* --- Fade-in animation --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeUp 0.35s ease forwards;
}

/* --- Hero / Banner --- */
.hero {
  border-bottom: 3px solid var(--accent);
  padding-bottom: 3.2rem;
  margin-bottom: 4rem;
  transition: border-color var(--transition-med);
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: 0.8rem;
}

.hero .tagline {
  font-size: 1.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.hero .tagline a {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: var(--text);
  background: var(--bg-surface-hover);
  padding: 0.2em 0.6em;
  border-radius: 4px;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.hero .tagline a:hover {
  color: #fff;
  background: var(--accent);
}

.hero .social {
  margin-top: 2rem;
  display: flex;
  gap: 1.2rem;
}

.hero .social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero .social img {
  height: 28px;
  opacity: 0.6;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

[data-theme="dark"] .hero .social img {
  filter: invert(1);
}

.hero .social a:hover img {
  opacity: 1;
  transform: translateY(-2px);
}

/* --- Body text / About --- */
.about-section h2 {
  position: relative;
  padding-left: 0;
}

.about-section h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 0.8em;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 1rem;
  vertical-align: middle;
}

.section-date {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-faint);
  margin-left: 0.8rem;
  font-weight: 400;
}

.about-section ul {
  list-style: none;
  margin-left: 0;
}

.about-section ul li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.8rem;
}

.about-section ul li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
}

.tech-list {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--text-muted);
}

/* --- Contact --- */
.contact {
  margin-top: 4rem;
  padding-top: 3.2rem;
  border-top: 1px solid var(--border);
  transition: border-color var(--transition-med);
}

.contact h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 0.8em;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 1rem;
  vertical-align: middle;
}

#email {
  font-family: var(--font-mono);
  color: var(--accent);
}

/* --- Work section --- */
.work-section h2::before,
.recent-writing h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 0.8em;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 1rem;
  vertical-align: middle;
}

.work-section p a strong {
  color: var(--text);
  transition: color var(--transition-fast);
}

.work-section p a:hover strong {
  color: var(--accent);
}

/* --- Section divider --- */
.section-divider {
  margin: 3.2rem 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border) 15%,
    var(--border) 85%,
    transparent 100%
  );
}

/* --- Showcase (browser-window screenshot) --- */
.showcase {
  margin: 2.4rem 0;
}

.showcase-window {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow);
  transition: border-color var(--transition-med), box-shadow var(--transition-med);
}

.showcase-window:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.showcase-titlebar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.4rem;
  background: var(--bg-code);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-med), border-color var(--transition-med);
}

.showcase-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.showcase-titlebar-text {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-faint);
  margin-left: 0.8rem;
}

.showcase-img-link {
  display: block;
  position: relative;
  overflow: hidden;
  line-height: 0;
}

.showcase-img-link img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease;
}

.showcase-window:hover .showcase-img-link img {
  transform: scale(1.015);
}

/* Scan line: a subtle light sweep on hover */
.showcase-scan {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(204, 102, 0, 0.06) 40%,
    rgba(204, 102, 0, 0.1) 50%,
    rgba(204, 102, 0, 0.06) 60%,
    transparent 100%
  );
  pointer-events: none;
  transition: none;
}

.showcase-window:hover .showcase-scan {
  animation: scanSweep 0.8s ease forwards;
}

@keyframes scanSweep {
  from { left: -60%; }
  to { left: 120%; }
}

.showcase-caption {
  font-size: 1.4rem !important;
  color: var(--text-muted);
  margin-top: 1.2rem;
  padding-left: 1.6rem;
  border-left: 3px solid var(--accent);
}

.see-all {
  margin-top: 1.6rem;
  font-family: var(--font-mono);
  font-size: 1.4rem;
}

/* --- Blog list --- */
.blog-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blog-list li {
  padding: 0;
  margin: 0;
}

.blog-entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition-med);
}

.blog-entry:first-child {
  padding-top: 0;
}

.blog-entry:hover {
  background: var(--bg-surface-hover);
  margin-left: -1rem;
  margin-right: -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: 4px;
  border-bottom-color: transparent;
}

.blog-entry .post-title {
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--text);
  transition: color var(--transition-fast);
}

.blog-entry .post-title::before {
  content: "\f15c  ";
  font-family: "Font Awesome 5 Free";
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--text-faint);
  margin-right: 0.6rem;
}

.blog-entry:hover .post-title {
  color: var(--accent);
}

.blog-entry .post-date {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.blog-entry .post-excerpt {
  display: none;
}

@media (max-width: 500px) {
  .blog-entry {
    flex-direction: column;
    gap: 0.3rem;
  }
}

/* --- Blog article body --- */
.blog-date {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}

.blog-body h1 {
  font-size: 3.2rem;
  margin-top: 0;
  margin-bottom: 2.4rem;
  line-height: 1.2;
}

.blog-body h2 {
  font-size: 2.2rem;
  margin-top: 3.2rem;
  margin-bottom: 1.2rem;
}

.blog-body h3 {
  font-size: 1.9rem;
  margin-top: 2.4rem;
  margin-bottom: 0.8rem;
}

.blog-body p {
  margin-bottom: 1.6rem;
}

.blog-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-fast), color var(--transition-fast);
}

.blog-body a:hover {
  text-decoration-color: var(--accent);
  color: var(--accent-hover);
}

.blog-body img {
  border-radius: 6px;
  margin: 1.6rem 0;
}

/* --- Talks / other pages --- */
.page-body {
  padding-bottom: 4rem;
}

.page-body h2 {
  margin-bottom: 2rem;
}

.page-body h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 0.8em;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 1rem;
  vertical-align: middle;
}

.regular-links {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--accent);
  margin-left: 1.6rem;
  padding: 0.2em 0.8em;
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.regular-links:hover {
  background: var(--accent);
  color: #fff;
}

/* --- Link underline animation (used on nav, general) --- */
.animated-link {
  position: relative;
}

.animated-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-med);
}

.animated-link:hover::after {
  transform: scaleX(1);
}

/* --- Mobile responsive --- */
@media (max-width: 700px) {
  .tab-bar {
    flex-wrap: wrap;
  }

  .tab-bar .logo-tab {
    border-right: none;
    padding-right: 1.2rem;
  }

  .tab-bar .spacer {
    order: 3;
    flex-basis: 100%;
    height: 0;
  }

  .tab-bar nav {
    order: 4;
    width: 100%;
    border-top: 1px solid var(--border);
  }

  .tab-bar nav a {
    flex: 1;
    justify-content: center;
    font-size: 1.4rem;
    padding: 1rem;
  }

  .tab-bar .theme-toggle {
    order: 2;
    margin-left: auto;
  }

  h1 {
    font-size: 2.8rem;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .hero .tagline {
    font-size: 1.6rem;
  }

  .blog-body h1 {
    font-size: 2.4rem;
  }

  .content-area {
    padding: 2rem 0 4rem 0;
  }
}

@media (max-width: 500px) {
  .container {
    padding: 0 4%;
  }

  h1 {
    font-size: 2.4rem;
  }

  .hero h1 {
    font-size: 2.6rem;
  }

  p, li {
    font-size: 1.6rem;
  }

  pre code {
    font-size: 1.3rem;
  }
}

/* --- Print --- */
@media print {
  .gutter, .tab-bar .theme-toggle {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
}
