:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f6;
  --text: #17202a;
  --muted: #647180;
  --line: #d9e0e7;
  --primary: #147c89;
  --primary-dark: #0f5962;
  --accent: #d85f49;
  --shadow: 0 10px 28px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans KR", sans-serif;
  line-height: 1.55;
}

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

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  overflow-wrap: break-word;
}

.container {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.narrow {
  max-width: 920px;
}

.section {
  padding: 48px 0;
  scroll-margin-top: 76px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.logo {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 900;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  padding: 8px 11px;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
  background: var(--surface-soft);
  color: var(--primary-dark);
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--text);
}

.hero {
  padding: 54px 0 42px;
}

.page-hero {
  padding: 42px 0 28px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 340px;
  gap: 28px;
  align-items: stretch;
}

.hero-content,
.profile-card,
.skill-card,
.project-card,
.contact-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: stretch;
}

.page-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.page-panel h1 {
  max-width: 820px;
}

.page-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow,
.section-label {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 720px;
  margin-bottom: 16px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 12px;
  font-size: 28px;
  line-height: 1.22;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.3;
}

.hero-description {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 900;
  padding: 8px 14px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-dark);
}

.button.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--primary-dark);
}

.button.ghost {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 22px;
  text-align: center;
}

.profile-image {
  width: 170px;
  height: 170px;
  margin: 0 auto 18px;
  border: 5px solid var(--surface-soft);
  border-radius: 50%;
  box-shadow: 0 12px 24px rgba(23, 32, 42, 0.15);
  object-fit: cover;
}

.profile-card h2 {
  margin-bottom: 6px;
  color: var(--primary-dark);
  font-size: 26px;
}

.profile-card > p {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 900;
  padding: 5px 12px;
}

.profile-meta {
  display: grid;
  width: 100%;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.profile-meta li {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 10px;
}

.narrow p,
.skill-card p,
.project-card p,
.section-heading p,
.contact-box p {
  color: var(--muted);
}

.narrow p {
  margin-bottom: 10px;
}

.muted {
  background: var(--surface-soft);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading p {
  max-width: 440px;
  margin-bottom: 0;
  font-size: 15px;
}

.skill-grid,
.project-grid {
  display: grid;
  gap: 12px;
}

.content-list {
  display: grid;
  gap: 12px;
}

.skill-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.skill-card,
.project-card {
  padding: 18px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.skill-card:hover,
.project-card:hover {
  border-color: rgba(20, 124, 137, 0.42);
  transform: translateY(-2px);
}

.skill-card p,
.project-card p {
  margin-bottom: 0;
  font-size: 14px;
}

.project-card {
  display: flex;
  flex-direction: column;
  min-height: 215px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 18px;
  padding: 0;
  list-style: none;
}

.project-tags li {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  padding: 4px 9px;
}

.project-card .button {
  align-self: flex-start;
  margin-top: auto;
}

.contact-section {
  padding-top: 28px;
}

.contact-box {
  padding: 30px;
}

.contact-box h2 {
  max-width: 720px;
  margin-bottom: 10px;
}

.contact-box p {
  margin-bottom: 0;
}

.contact-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--primary-dark);
  font-weight: 900;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.site-footer p {
  margin-bottom: 0;
}

/* Auth-aware navigation */
.auth-only {
  display: none;
}

.guest-only {
  display: inline-flex;
}

body.logged-in .auth-only {
  display: inline-flex;
}

body.logged-in .guest-only {
  display: none;
}

.nav-logout {
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  padding: 8px 11px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-logout:hover,
.nav-logout:focus-visible {
  background: var(--surface-soft);
  color: var(--primary-dark);
}

/* Forms: login / signup / write */
.form-card {
  max-width: 440px;
  margin: 0 auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-card.wide {
  max-width: 720px;
}

.form-card h1 {
  max-width: none;
  margin-bottom: 22px;
  font-size: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 800;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  min-height: 260px;
  line-height: 1.6;
  resize: vertical;
}

.form-group.error input,
.form-group.error textarea {
  border-color: #d64545;
}

.form-error {
  min-height: 18px;
  margin-top: 6px;
  color: #d64545;
  font-size: 13px;
  font-weight: 700;
}

.form-message {
  min-height: 20px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 800;
}

.form-message.success {
  color: var(--primary-dark);
}

.form-message.error {
  color: #d64545;
}

.form-actions {
  margin-top: 22px;
}

.form-actions .button {
  width: 100%;
}

.form-footnote {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.form-footnote a {
  color: var(--primary-dark);
  font-weight: 800;
}

.button.danger {
  background: #d64545;
  color: #ffffff;
}

.button.danger:hover,
.button.danger:focus-visible {
  background: #b83a3a;
}

/* Post list */
.post-list {
  display: grid;
  gap: 12px;
}

.post-card {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.post-card:hover,
.post-card:focus-visible {
  border-color: rgba(20, 124, 137, 0.42);
  transform: translateY(-2px);
}

.post-card h3 {
  margin-bottom: 6px;
}

.post-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.post-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.my-post-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  transform: none;
}

.my-post-card:hover {
  transform: none;
}

.my-post-info {
  min-width: 0;
}

.my-post-title {
  display: block;
}

.my-post-title h3 {
  margin-bottom: 6px;
}

.my-post-info .post-meta {
  margin-bottom: 0;
}

.my-post-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.empty-state {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state .button {
  margin-top: 16px;
}

/* Post detail */
.post-detail-head {
  margin-bottom: 24px;
}

.post-detail-body {
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.post-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}

/* Profile page */
.profile-guard {
  padding: 60px 20px;
  text-align: center;
}

.profile-guard p {
  margin-bottom: 16px;
  color: var(--muted);
}

.profile-page-card {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.profile-page-card .profile-image {
  margin: 0 auto 18px;
}

.profile-page-card h1 {
  max-width: none;
  margin-bottom: 4px;
  font-size: 26px;
}

.profile-page-card .section-label {
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .section {
    padding: 38px 0;
  }

  .hero {
    padding: 40px 0 34px;
  }

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

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

  .hero-content {
    padding: 28px;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 6px;
  }

  .skill-grid,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .container {
    width: min(100% - 24px, 1080px);
  }

  .header-inner {
    min-height: 56px;
  }

  .menu-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: 56px;
    right: 12px;
    left: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 10px;
  }

  .section {
    padding: 32px 0;
    scroll-margin-top: 64px;
  }

  .hero {
    padding: 28px 0;
  }

  .page-hero {
    padding: 26px 0 18px;
  }

  .hero-content,
  .page-panel,
  .profile-card,
  .contact-box,
  .form-card {
    padding: 22px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 24px;
  }

  .hero-description {
    font-size: 15px;
  }

  .profile-image {
    width: 148px;
    height: 148px;
  }

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

  .button {
    width: 100%;
  }
}
