@font-face {
    font-family: "Pretendard";
    src: url("../fonts/PretendardVariable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --blue: #3478f6;
    --ink: #171b24;
    --muted: #6d7582;
    --line: #e0e5ec;
    --background: #f5f7fa;
    --paper: #ffffff;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--ink);
    font-family: "Pretendard", sans-serif;
    letter-spacing: .02em;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
body.editor-open { overflow: hidden; }

.page-header {
    min-height: 72px;
    padding: 12px max(28px, calc((100vw - 1180px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}
.page-title {
    font-size: 24px;
    font-weight: 760;
    letter-spacing: .12em;
}
.header-actions { display: flex; align-items: center; gap: 9px; }
.header-button {
    min-height: 42px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d7dde6;
    border-radius: 14px;
    background: #fff;
    color: #343a46;
    font-weight: 650;
    cursor: pointer;
    transition: transform .18s, border-color .18s, background .18s;
}
.header-button:hover { transform: translateY(-1px); border-color: #aab4c2; }
.header-button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.header-button[hidden] { display: none; }

main { padding-bottom: 92px; }
.intro {
    max-width: 1180px;
    margin: 0 auto;
    padding: 86px 28px 58px;
}
.intro > p {
    margin: 0 0 18px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
}
.intro h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(46px, 6.5vw, 82px);
    line-height: .99;
    letter-spacing: -.055em;
}
.intro span {
    display: block;
    margin-top: 24px;
    color: var(--muted);
    font-size: 15px;
}
.paper-section { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.paper-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.paper-card {
    min-width: 0;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid #e6eaf0;
    border-radius: 24px;
    box-shadow: 0 14px 34px rgba(25, 37, 58, .07);
    transition: transform .2s, box-shadow .2s;
}
.paper-card:hover { transform: translateY(-4px); box-shadow: 0 20px 46px rgba(25, 37, 58, .12); }
.paper-link { display: block; }
.paper-cover {
    position: relative;
    aspect-ratio: 4 / 5.35;
    overflow: hidden;
    background: linear-gradient(145deg, #e7ebf1, #cfd7e2);
}
.paper-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.paper-cover span {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    color: #758093;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}
.paper-cover.image-error span { display: grid; }
.paper-content { padding: 20px 21px 22px; }
.paper-content p { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 700; }
.paper-content h2 {
    margin: 0;
    overflow: hidden;
    font-size: 21px;
    line-height: 1.35;
    letter-spacing: -.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.paper-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 12px; }
.paper-actions button {
    min-height: 40px;
    border: 0;
    border-radius: 12px;
    background: #edf3ff;
    color: #2c63bf;
    font-weight: 700;
    cursor: pointer;
}
.paper-actions .delete-button { background: #fff0f1; color: #d44650; }
.paper-state {
    padding: 72px 24px;
    border: 1px dashed #cfd6e0;
    border-radius: 22px;
    background: rgba(255, 255, 255, .6);
    text-align: center;
}
.paper-state[hidden] { display: none; }
.paper-state strong { font-size: 18px; }
.paper-state p { margin: 9px 0 0; color: var(--muted); font-size: 14px; }

.editor-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; opacity: 0; transition: opacity .22s; }
.editor-layer[hidden] { display: none; }
.editor-layer.is-visible { opacity: 1; }
.editor-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(15, 20, 29, .58); cursor: default; }
.editor-dialog {
    position: relative;
    width: min(620px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    overflow: auto;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .24);
    transform: translateY(14px) scale(.985);
    transition: transform .22s;
    scrollbar-gutter: stable;
}
.editor-layer.is-visible .editor-dialog { transform: none; }
.editor-head { padding: 25px 26px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.editor-head h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.editor-head p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.editor-close { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; padding: 0 0 3px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #4e5664; font-size: 25px; line-height: 1; cursor: pointer; }
.editor-close:disabled { opacity: .45; cursor: not-allowed; }
#editorForm { padding: 24px 26px 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field, .file-field { min-width: 0; }
.full-field { grid-column: 1 / -1; }
.field span, .file-field > span { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #d7dde6;
    border-radius: 13px;
    outline: none;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(52, 120, 246, .13); }
.file-field {
    position: relative;
    min-height: 130px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px dashed #bfc8d5;
    border-radius: 15px;
    background: #f8fafc;
    cursor: pointer;
}
.file-field strong { color: #344152; font-size: 15px; }
.file-field small { margin-top: 7px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-field input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.submit-button {
    grid-column: 1 / -1;
    min-height: 50px;
    margin-top: 2px;
    border: 0;
    border-radius: 14px;
    background: var(--blue);
    color: #fff;
    font-weight: 750;
    cursor: pointer;
}
.submit-button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 850px) {
    .paper-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .page-header { min-height: 112px; padding: 15px 18px; align-items: flex-start; flex-direction: column; gap: 10px; }
    .page-title { width: 100%; font-size: 22px; text-align: center; }
    .header-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
    .header-actions:has(.primary[hidden]) { grid-template-columns: 1fr; }
    .header-actions .header-button:only-child { grid-column: 1 / -1; }
    .intro { padding: 58px 20px 42px; }
    .intro h1 { font-size: clamp(40px, 12vw, 58px); }
    .paper-section { padding: 0 20px; }
    .paper-grid { grid-template-columns: 1fr; gap: 18px; }
    .paper-card { border-radius: 20px; }
    .editor-layer { padding: 18px; align-items: center; }
    .editor-dialog { max-height: calc(100vh - 36px); border-radius: 21px; }
    .editor-head { padding: 21px 20px 17px; }
    #editorForm { padding: 20px; grid-template-columns: 1fr; }
    .full-field, .submit-button { grid-column: auto; }
}
