@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&family=Noto+Serif+KR:wght@500;700;900&display=swap");

:root {
  --ink: #171714;
  --muted: #68665f;
  --paper: #f7f2e8;
  --paper-deep: #ebe3d4;
  --line: #24231f;
  --soft-line: #b9b09f;
  --accent: #a22c27;
  --accent-dark: #79201d;
  --serif: "Noto Serif KR", Georgia, serif;
  --sans: "Noto Sans KR", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.78), transparent 30%),
    #d9d2c5;
  font-family: var(--sans);
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(162, 44, 39, 0.28);
  outline-offset: 2px;
}

.page-shell {
  width: min(1500px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px clamp(18px, 3.5vw, 54px) 36px;
  background:
    repeating-linear-gradient(0deg, rgba(30, 27, 21, 0.018) 0, rgba(30, 27, 21, 0.018) 1px, transparent 1px, transparent 4px),
    var(--paper);
  box-shadow: 0 0 70px rgba(36, 30, 22, 0.18);
}

.utility-row,
.edition-row,
.archive-toolbar,
.form-actions,
.character-row,
.save-dock {
  display: flex;
  align-items: center;
}

.utility-row {
  justify-content: space-between;
  gap: 18px;
  padding: 7px 0 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.back-link,
.text-button {
  color: inherit;
  text-decoration: none;
}

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

.today-label {
  margin: 0;
  text-align: center;
}

.session-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.storage-mode {
  color: var(--muted);
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.nameplate {
  padding: clamp(22px, 4vw, 42px) 0 20px;
  text-align: center;
}

.nameplate p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(0.68rem, 1.2vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.2em;
}

.nameplate h1 {
  margin: 5px 0 9px;
  font-family: var(--serif);
  font-size: clamp(2.65rem, 7vw, 6.7rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.09em;
}

.edition-row {
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-top: 4px double var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(0, 1fr);
  gap: clamp(26px, 4vw, 58px);
  padding-top: 30px;
}

.editorial-desk {
  align-self: start;
  position: sticky;
  top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  background: rgba(235, 227, 212, 0.72);
}

.section-heading {
  padding-bottom: 14px;
  border-bottom: 4px solid var(--line);
}

.section-heading span,
.kicker {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.section-heading h2,
.archive-toolbar h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-weight: 900;
  letter-spacing: -0.05em;
}

.section-heading h2 {
  font-size: 1.7rem;
}

.article-form {
  display: grid;
  gap: 8px;
  padding-top: 18px;
}

.article-form label,
.search-box span {
  font-size: 0.78rem;
  font-weight: 900;
}

.article-form input,
.article-form textarea,
.search-box input {
  width: 100%;
  border: 1px solid var(--soft-line);
  border-radius: 0;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.74);
}

.article-form input,
.search-box input {
  height: 43px;
  padding: 0 12px;
}

.article-form textarea {
  min-height: 205px;
  padding: 11px 12px;
  line-height: 1.7;
  resize: vertical;
}

.article-form input:focus,
.article-form textarea:focus,
.search-box input:focus {
  border-color: var(--accent);
  background: #fffdf8;
}

.character-row {
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
}

.form-actions {
  gap: 8px;
  margin-top: 8px;
}

.primary-button,
.secondary-button,
.save-button,
.article-action {
  border: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  flex: 1;
  min-height: 48px;
  color: var(--paper);
  background: var(--ink);
}

.primary-button:hover,
.save-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
}

.desk-note {
  margin-top: 24px;
  padding-top: 15px;
  border-top: 1px solid var(--soft-line);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.76rem;
  line-height: 1.75;
}

.desk-note strong {
  color: var(--ink);
}

.desk-note p {
  margin: 6px 0 0;
}

.archive-toolbar {
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 4px solid var(--line);
}

.kicker {
  margin: 0;
}

.archive-toolbar h2 {
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.archive-toolbar h2 span {
  color: var(--accent);
}

.search-box {
  display: grid;
  width: min(290px, 100%);
  gap: 6px;
}

.article-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(22px, 3vw, 42px);
}

.article-card {
  position: relative;
  padding: 26px 0 28px;
  border-bottom: 1px solid var(--line);
}

.article-card:nth-child(odd)::after {
  content: "";
  position: absolute;
  top: 26px;
  right: calc(clamp(22px, 3vw, 42px) / -2);
  bottom: 28px;
  width: 1px;
  background: var(--soft-line);
}

.article-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.article-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-weight: 900;
  line-height: 1.32;
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
}

.article-url {
  display: block;
  margin: 12px 0 16px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration-color: var(--soft-line);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-url:hover {
  color: var(--accent);
}

.article-content {
  margin: 0;
  color: #36342f;
  font-family: var(--serif);
  font-size: 0.94rem;
  line-height: 1.92;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.article-content::first-letter {
  float: left;
  margin: 0.08em 0.1em 0 0;
  color: var(--accent);
  font-size: 3.1em;
  font-weight: 900;
  line-height: 0.8;
}

.article-actions {
  display: flex;
  gap: 7px;
  margin-top: 20px;
}

.article-action {
  padding: 6px 10px;
  color: var(--ink);
  background: transparent;
  font-size: 0.72rem;
}

.article-action:hover {
  color: var(--paper);
  background: var(--ink);
}

.article-action.delete:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 40px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  text-align: center;
  line-height: 1.8;
}

.save-dock {
  justify-content: space-between;
  gap: 20px;
  margin-top: 42px;
  padding: 18px 0 0;
  border-top: 4px double var(--line);
  color: var(--ink);
}

.save-dock p {
  margin: 0;
  font-size: 0.78rem;
}

.save-dock p.is-error {
  color: var(--accent);
}

.save-button {
  min-height: 42px;
  padding: 0 20px;
  border-color: var(--line);
  color: var(--paper);
  background: var(--ink);
}

.save-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .editorial-desk {
    position: static;
  }
}

@media (max-width: 650px) {
  .page-shell {
    width: 100%;
    padding: 12px 16px 28px;
  }

  .utility-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .today-label {
    order: 3;
    width: 100%;
    text-align: left;
  }

  .storage-mode {
    display: none;
  }

  .edition-row span:nth-child(2) {
    display: none;
  }

  .archive-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .article-list {
    grid-template-columns: 1fr;
  }

  .article-card:nth-child(odd)::after {
    display: none;
  }

  .save-dock {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
  }

  .save-dock p {
    max-width: none;
  }

  .save-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
