:root {
  color-scheme: dark;
  --bg: #070707;
  --panel: #151515;
  --line: #2b2b2b;
  --text: #f4f4f4;
  --muted: #a1a1a1;
  --soft: #777;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08), transparent 32rem),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: auto, 46px 46px, 46px 46px;
}

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

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 clamp(18px, 5vw, 56px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 7, 7, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  font-size: 17px;
  font-weight: 850;
}

.site-header nav {
  display: flex;
  gap: clamp(14px, 3vw, 28px);
}

.nav-link {
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link.active {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.section-shell {
  width: min(1024px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 120px 0 80px;
}

.profile-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(260px, 1fr);
  align-items: center;
  width: min(720px, 100%);
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #111;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.62);
}

.avatar {
  display: grid;
  min-height: 360px;
  place-items: center;
  background:
    linear-gradient(180deg, transparent 18%, rgba(255, 255, 255, 0.05)),
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(255, 255, 255, 0.05) 9px 10px);
}

.avatar img {
  width: 170px;
  height: 170px;
  object-fit: cover;
  border: 5px solid #fff;
  border-radius: 8px;
  filter: grayscale(1) contrast(1.08);
}

.profile-copy {
  padding: 36px;
}

.kicker {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(36px, 7vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.tagline {
  max-width: 380px;
  margin-bottom: 30px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
}

.english-name {
  margin: -4px 0 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.contact-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.72);
}

.contact-panel a {
  padding: 10px 14px;
  border-radius: 8px;
  background: #1a1a1a;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.content-section {
  padding: 72px 0 88px;
  scroll-margin-top: 84px;
}

.section-heading {
  margin-bottom: 42px;
}

.row-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading h2 {
  margin-bottom: 8px;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
}

.text-link {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.project-card {
  display: block;
  min-height: 424px;
  padding: 8px 8px 20px;
  border-radius: 8px;
  background: var(--panel);
  transition: transform 160ms ease, background 160ms ease;
}

.project-card:hover,
.post-card:hover {
  transform: translateY(-3px);
  background: #1a1a1a;
}

.project-directory {
  display: grid;
  gap: 14px;
}

.directory-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.72);
  transition: transform 160ms ease, background 160ms ease;
}

.directory-card:hover {
  transform: translateY(-2px);
  background: #181818;
}

.directory-card h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.directory-card p {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.directory-meta {
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.project-preview {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border-radius: 8px;
  background: #0f0f0f;
}

.project-preview::before,
.project-preview::after,
.project-preview span {
  position: absolute;
  content: "";
}

.preview-portfolio::before {
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.preview-portfolio::after {
  right: 28px;
  bottom: 26px;
  width: 92px;
  height: 92px;
  border: 5px solid #fff;
  border-radius: 8px;
}

.preview-portfolio span {
  top: 42px;
  left: 30px;
  width: 46%;
  height: 12px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 28px 0 #777, 0 56px 0 #303030;
}

.preview-dashboard {
  background:
    linear-gradient(135deg, #111, #252525),
    #101010;
}

.preview-dashboard::before {
  inset: 28px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #f4f4f4 0 32%, transparent 32%),
    linear-gradient(#3b82f6 0 0) 14px 74px / 38% 12px no-repeat,
    linear-gradient(#737373 0 0) 14px 102px / 72% 10px no-repeat,
    #080808;
}

.preview-dashboard::after {
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 48px;
  border-radius: 4px;
  background: #22c55e;
}

.preview-service {
  background:
    radial-gradient(circle at 70% 35%, rgba(255, 255, 255, 0.16), transparent 5rem),
    linear-gradient(135deg, #080808, #202020);
}

.preview-service::before {
  inset: 28px 24px auto;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 34px 0 #626262, 0 68px 0 #333;
}

.preview-service::after {
  right: 34px;
  bottom: 30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, #fff, #525252, #181818, #fff);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 10px 16px;
}

.chips span {
  padding: 4px 10px;
  border-radius: 999px;
  color: #ddd;
  background: #2a2a2a;
  font-size: 12px;
  font-weight: 800;
}

.project-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 10px;
}

.project-title h3 {
  margin-bottom: 10px;
  font-size: 19px;
  letter-spacing: 0;
}

.project-title time,
.post-card time {
  color: var(--muted);
  font-size: 13px;
}

.project-card p {
  margin: 0;
  padding: 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.post-list {
  display: grid;
  gap: 16px;
}

.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 32px;
  align-items: center;
  min-height: 204px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 8, 8, 0.62);
  transition: transform 160ms ease, background 160ms ease;
}

.post-card h3 {
  max-width: 560px;
  margin-bottom: 14px;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.1;
  letter-spacing: 0;
}

.post-card p {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.post-thumb {
  height: 148px;
  border-radius: 8px;
  background: #171717;
}

.thumb-code {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.92) 0 48%, transparent 48%),
    repeating-linear-gradient(0deg, rgba(34, 197, 94, 0.55) 0 3px, transparent 3px 12px),
    #0a0a0a;
}

.thumb-dark {
  background:
    radial-gradient(circle at 70% 50%, rgba(59, 130, 246, 0.45), transparent 4rem),
    linear-gradient(135deg, #050505, #1d1d1d);
}

.timeline {
  display: grid;
  gap: 52px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 40px;
}

.year {
  position: relative;
  padding-left: 26px;
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 950;
  line-height: 1;
}

.year::before {
  position: absolute;
  top: 13px;
  left: 0;
  width: 10px;
  height: 10px;
  border: 4px solid #050505;
  border-radius: 50%;
  background: #3a3a3a;
  box-shadow: 0 0 0 1px #262626;
  content: "";
}

.job h3 {
  margin-bottom: 8px;
  font-size: 25px;
}

.role {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 19px;
  font-weight: 800;
}

.job ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
  color: #e6e6e6;
  line-height: 1.5;
}

.detail-main {
  padding: 118px 0 110px;
}

.detail-hero {
  max-width: 780px;
  margin-bottom: 42px;
}

.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.back-link:hover {
  color: var(--text);
}

.detail-hero h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.14;
}

.detail-summary {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 56px;
  align-items: start;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.detail-article {
  max-width: 720px;
}

.detail-article h2 {
  margin: 38px 0 14px;
  font-size: 22px;
  line-height: 1.2;
}

.detail-article h2:first-child {
  margin-top: 0;
}

.detail-article p,
.detail-article li {
  color: #d8d8d8;
  font-size: 17px;
  line-height: 1.85;
}

.detail-article p {
  margin-bottom: 20px;
}

.detail-article ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.detail-article img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 8px 0 20px;
  border: 1px solid var(--line);
}

/* 이미지 삽입 위치 표시 — Trilium에서 실제 이미지로 교체하면 사라짐 */
.detail-article figure.img-placeholder,
.post-body figure.img-placeholder {
  border: 2px dashed var(--line);
  border-radius: 6px;
  padding: 3rem 1.5rem;
  text-align: center;
  margin: 8px 0 24px;
}

.detail-article figure.img-placeholder figcaption,
.post-body figure.img-placeholder figcaption {
  color: var(--muted);
  font-size: 14px;
  margin-top: 0;
}

/* 이미지 3장 가로 배열 — Trilium HTML에서 <div class="image-row">로 감싸기 */
.detail-article .image-row,
.post-body .image-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 8px 0 24px;
}

.detail-article .image-row img,
.post-body .image-row img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 6px;
  margin: 0;
}

.detail-article .image-row figure,
.post-body .image-row figure {
  margin: 0;
}

.detail-article .image-row figure.img-placeholder,
.post-body .image-row figure.img-placeholder {
  height: 220px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

@media (max-width: 600px) {
  .detail-article .image-row,
  .post-body .image-row {
    grid-template-columns: 1fr;
  }
  .detail-article .image-row img,
  .post-body .image-row img {
    height: auto;
  }
}

.detail-hero-img {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 42px;
  border: 1px solid var(--line);
}

.project-preview img,
.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.detail-sidebar {
  position: sticky;
  top: 96px;
  padding: 18px 0 0;
}

.detail-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.detail-link-btn {
  display: block;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.detail-link-btn:hover {
  border-color: var(--text);
  background: var(--panel);
}

.meta-list {
  display: grid;
  gap: 0;
  align-content: start;
  margin: 0;
}

.meta-list div {
  padding: 0 0 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.meta-list dt {
  margin-bottom: 4px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.meta-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 750;
}

@media (max-width: 980px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-card,
  .timeline-item,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-layout {
    gap: 34px;
  }

  .detail-sidebar {
    position: static;
    padding-top: 0;
  }

  .post-thumb {
    order: -1;
  }
}

@media (max-width: 680px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-height: 86px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .site-header nav {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .brand,
  .nav-link {
    font-size: 15px;
  }

  .section-shell {
    width: min(100% - 28px, 1024px);
  }

  .hero {
    padding-top: 126px;
  }

  .profile-card {
    grid-template-columns: 1fr;
  }

  .avatar {
    min-height: 240px;
  }

  .avatar img {
    width: 132px;
    height: 132px;
  }

  .profile-copy {
    padding: 28px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .row-heading,
  .directory-card {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .timeline-item {
    gap: 20px;
  }

  .detail-main {
    padding-top: 132px;
  }
}
