:root {
  --ink: #161616;
  --charcoal: #2e2e33;
  --muted: #77777d;
  --pale: #f6f6f6;
  --soft: #eeeeef;
  --line: #dedee2;
  --white: #ffffff;
  --accent: #5d536f;
  --accent-soft: #aaa1ba;
  --danger: #aa3a32;
  color: var(--ink);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 86px;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--white);
}

body,
button,
input,
select,
textarea {
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 18px clamp(18px, 4vw, 52px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(222, 222, 226, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  gap: 2px;
  font-weight: 850;
  letter-spacing: 0;
}

.brand span {
  font-size: 0.98rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
}

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

.site-header nav a,
.nav-admin {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: 0;
}

.site-header nav a:hover,
.nav-admin:hover {
  color: var(--accent);
}

.nav-admin {
  padding: 0;
  background: transparent;
  border: 0;
}

.intro {
  min-height: calc(82svh - 72px);
  padding: clamp(78px, 10vw, 128px) clamp(18px, 5vw, 76px) clamp(54px, 7vw, 86px);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 1100px;
  margin-bottom: clamp(30px, 5vw, 62px);
  font-size: clamp(2.8rem, 6.6vw, 6.4rem);
  font-weight: 780;
  line-height: 0.92;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(240px, 0.34fr);
  gap: clamp(28px, 7vw, 92px);
  align-items: start;
}

.intro-lead {
  max-width: 850px;
  margin: 0;
  color: var(--charcoal);
  font-size: clamp(1.05rem, 1.68vw, 1.46rem);
  font-weight: 680;
  line-height: 1.62;
}

.intro-lead span {
  display: block;
}

.intro-lead span + span {
  margin-top: 4px;
}

.intro-notes {
  display: grid;
  gap: 10px;
  padding-top: 8px;
}

.intro-notes span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.portfolio-section {
  padding: clamp(54px, 7vw, 92px) clamp(6px, 1.4vw, 18px) clamp(70px, 8vw, 118px);
}

.portfolio-heading {
  max-width: 980px;
  margin: 0 auto 26px;
  padding: 0 clamp(10px, 2vw, 28px);
  text-align: center;
}

.portfolio-heading h2,
.contact h2,
.admin-panel h2 {
  margin: 0;
  font-size: clamp(1.85rem, 3.4vw, 3.6rem);
  font-weight: 780;
  line-height: 1.04;
}

.filters {
  position: sticky;
  top: 72px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px clamp(18px, 3vw, 34px);
  margin: 0 auto 28px;
  padding: 18px 12px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.filter-button {
  position: relative;
  min-height: 34px;
  padding: 0 0 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 0.86rem;
  font-weight: 760;
}

.filter-button::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: transparent;
  content: "";
}

.filter-button:hover,
.filter-button.is-active {
  color: var(--accent);
}

.filter-button.is-active::after {
  background: var(--accent);
}

.empty-message {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  text-align: center;
}

.portfolio-window {
  position: relative;
  overflow: visible;
}

.portfolio-window.is-limited {
  max-height: 5000px;
  overflow: hidden;
}

.portfolio-mask {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  height: min(420px, 24vw);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--white) 82%);
}

.portfolio-window.is-limited .portfolio-mask {
  display: block;
}

.portfolio-more {
  display: block;
  width: min(280px, calc(100% - 36px));
  min-height: 50px;
  margin: 34px auto 0;
  color: var(--white);
  background: var(--charcoal);
  border: 1px solid var(--charcoal);
  font-size: 0.9rem;
  font-weight: 780;
}

.portfolio-more:hover {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(var(--masonry-columns, 5), minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.masonry-column {
  display: grid;
  gap: 20px;
  align-content: start;
}

.work-card {
  display: grid;
  gap: 12px;
  width: 100%;
  margin: 0;
  background: transparent;
}

.work-card button {
  position: relative;
  display: block;
  width: 100%;
  max-height: 800px;
  overflow: hidden;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 24px;
  cursor: zoom-in;
}

.work-card button::before,
.work-card button::after {
  position: absolute;
  opacity: 0;
  transition: opacity 220ms ease;
  content: "";
}

.work-card button::before {
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.42);
}

.work-card button::after {
  top: 50%;
  left: 50%;
  z-index: 3;
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 820;
  letter-spacing: 0;
  white-space: nowrap;
  content: "자세히보기";
  transform: translate(-50%, -50%);
}

.work-card img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--pale);
  transition: opacity 220ms ease, transform 420ms ease;
}

.work-card-info {
  display: grid;
  gap: 4px;
  padding: 0 10px 6px;
}

.work-card-info strong {
  color: #000000;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.42;
}

.work-card-info span {
  overflow: hidden;
  color: #d2d4e5;
  font-size: 0.68rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-card:hover img {
  transform: scale(1.025);
}

.work-card:hover button::before,
.work-card:hover button::after {
  opacity: 1;
}

.work-meta {
  font-size: 0.68rem;
  font-weight: 760;
  text-transform: uppercase;
}

.contact {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(320px, 0.68fr);
  gap: clamp(36px, 8vw, 116px);
  padding: clamp(74px, 10vw, 132px) clamp(18px, 5vw, 76px);
  background: #f7f7f8;
  border-top: 1px solid var(--line);
}

.contact-copy p {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.72;
}

.mail-link {
  display: inline-flex;
  margin-top: 20px;
  color: var(--accent);
  font-weight: 820;
}

.contact-form,
.admin-login,
.upload-form {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--charcoal);
  font-size: 0.82rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #cfcfd3;
  border-radius: 0;
  outline: 0;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 0;
  font-weight: 820;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.button.primary {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

.button.primary:hover {
  background: var(--ink);
  border-color: var(--ink);
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.form-message,
.admin-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 720;
  line-height: 1.6;
}

.work-dialog,
.admin-dialog {
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100svh - 28px);
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border: 0;
}

.admin-dialog {
  width: min(920px, calc(100vw - 28px));
  border: 1px solid var(--line);
}

.work-dialog::backdrop {
  background: rgba(246, 246, 247, 0.96);
}

.admin-dialog::backdrop {
  background: rgba(22, 22, 22, 0.46);
}

.icon-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.5rem;
}

.dialog-body,
.admin-panel {
  max-height: calc(100svh - 28px);
  overflow: auto;
}

.detail-view {
  display: grid;
  grid-template-columns: minmax(230px, 0.34fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  padding: clamp(30px, 5vw, 66px);
}

.detail-info {
  position: sticky;
  top: 34px;
  display: grid;
  gap: 20px;
  padding-top: 22px;
}

.detail-info h3 {
  margin: 0;
  font-size: clamp(1.55rem, 2.45vw, 2.6rem);
  font-weight: 780;
  line-height: 1.06;
}

.detail-info dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-info div {
  display: grid;
  gap: 4px;
}

.detail-info dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
  text-transform: uppercase;
}

.detail-info dd {
  margin: 0;
  color: var(--charcoal);
  line-height: 1.58;
}

.tool-launch {
  width: 100%;
  margin-top: 4px;
  text-decoration: none;
}

.detail-image img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--pale);
}

.admin-panel {
  display: grid;
  gap: 22px;
  padding: clamp(24px, 5vw, 46px);
}

.admin-panel p {
  color: var(--muted);
  line-height: 1.65;
}

.upload-drop {
  align-items: center;
  min-height: 118px;
  padding: 20px;
  color: var(--accent);
  text-align: center;
  background: var(--pale);
  border: 1px dashed var(--accent-soft);
}

.upload-drop input {
  background: var(--white);
}

.admin-work-list {
  display: grid;
  gap: 10px;
}

.edit-work-form {
  display: grid;
  gap: 14px;
  padding: 22px;
  background: var(--pale);
  border: 1px solid var(--line);
}

.edit-work-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.edit-work-heading h3 {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.cancel-edit,
.edit-work,
.delete-work {
  min-height: 36px;
  padding: 0 12px;
  background: #fff;
  font-weight: 820;
}

.cancel-edit,
.edit-work {
  color: var(--charcoal);
  border: 1px solid var(--line);
}

.admin-work-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-work-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
}

.admin-work-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  background: var(--pale);
}

.admin-work-item strong,
.admin-work-item span {
  display: block;
}

.admin-work-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.delete-work {
  color: var(--danger);
  border: 1px solid #e7cbc8;
}

.locked-work {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 820;
}

@media (max-width: 980px) {
  .intro-grid,
  .contact,
  .detail-view {
    grid-template-columns: 1fr;
  }

  .detail-info {
    position: static;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 118px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .site-header nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .site-header nav a,
  .nav-admin {
    flex: 0 0 auto;
  }

  .filters {
    top: 118px;
  }

  .form-row,
  .admin-work-item {
    grid-template-columns: 1fr;
  }

  .admin-work-actions {
    justify-content: flex-end;
  }

  .admin-work-item img {
    width: 100%;
    height: 120px;
  }
}

@media (max-width: 460px) {
  h1 {
    font-size: clamp(2.5rem, 14vw, 3.8rem);
  }
}
