/* วิทยาจารย์ Journal Archive — theme ported from the Withayajarn Archive design */
:root{
  --bg: #FBF8F3;
  --ink: #211C18;
  --ink-2: #1B1712;
  --accent: #C25B3A;
  --accent-hover: #A5462A;
  --accent-solid: #D96A47;
  --muted-1: #5A5149;
  --muted-2: #8A7F72;
  --muted-3: #A79C90;
  --muted-4: #B0A597;
  --muted-5: #B4A99E;
  --border-1: #EBE3D8;
  --border-2: #E4DACB;
  --border-3: #DCD2C4;
  --footer-bg: #F5EFE6;
  --card-tint-1: #F3EEE6;
  --card-tint-2: #EFEAE0;
  --card-tint-3: #F1ECDF;
  --card-tint-4: #EDE7DB;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background:var(--bg);
  color:var(--ink);
  font-family:'IBM Plex Sans Thai',system-ui,sans-serif;
  -webkit-font-smoothing:antialiased;
}
a{ color:var(--accent); text-decoration:none; }
a:hover{ color:var(--accent-hover); }
::selection{ background:#F0C9B8; }
input,select,button{ font-family:inherit; }
input::placeholder{ color:var(--muted-5); }
.serif{ font-family:'Kanit',serif; }
.wrap{ max-width:1180px; margin:0 auto; padding-left:40px; padding-right:40px; }

/* header */
.site-header{
  position:sticky; top:0; z-index:20;
  background:rgba(251,248,243,0.88);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border-1);
}
.site-header .inner{ display:flex; align-items:center; justify-content:space-between; height:74px; }
.brand{ display:flex; align-items:center; gap:12px; text-decoration:none; }
.brand:hover{ text-decoration:none; }
.brand-logo{ width:40px; height:40px; flex-shrink:0; }
.brand-text{ display:flex; flex-direction:column; gap:2px; }
.brand-th{ font-family:'Kanit',serif; font-weight:700; font-size:26px; letter-spacing:-0.01em; color:var(--ink); line-height:1.1; }
.brand-en{ font-size:11px; letter-spacing:0.22em; text-transform:uppercase; color:var(--muted-3); font-weight:500; }
.site-nav{ display:flex; align-items:center; gap:34px; font-size:14px; color:var(--muted-1); }
.site-nav a{ color:var(--muted-1); }

/* hero */
.hero{ padding-top:76px; padding-bottom:60px; }
.hero .eyebrow{ display:flex; align-items:center; gap:14px; margin-bottom:34px; }
.eyebrow-dot{ width:7px; height:7px; border-radius:50%; background:var(--accent-solid); display:inline-block; }
.eyebrow-label{ font-size:12px; letter-spacing:0.24em; text-transform:uppercase; color:var(--muted-3); font-weight:600; }
.hero-grid{ display:grid; grid-template-columns:352px 1fr; gap:64px; align-items:center; }
@media (max-width: 860px){ .hero-grid{ grid-template-columns:1fr; } }
.hero-cover{
  position:relative; border-radius:4px;
  box-shadow:0 30px 60px -24px rgba(60,44,30,0.35); overflow:hidden;
  background:var(--card-tint-1);
}
.hero-cover img{ width:100%; height:auto; display:block; }
.hero-meta-line{ font-size:13px; letter-spacing:0.14em; text-transform:uppercase; color:var(--muted-4); margin-bottom:18px; }
.hero-title{ font-family:'Kanit',serif; font-weight:700; font-size:52px; line-height:1.14; letter-spacing:-0.01em; margin:0 0 22px; color:var(--ink-2); }
.hero-desc{ font-size:17px; line-height:1.75; color:var(--muted-1); max-width:560px; margin:0 0 34px; }
.hero-actions{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.btn-primary{
  display:inline-flex; align-items:center; gap:10px; padding:14px 28px;
  background:var(--accent-solid); color:#fff; border-radius:999px; font-size:15px; font-weight:600; border:none; cursor:pointer;
}
.btn-primary:hover{ color:#fff; background:var(--accent-hover); }
.btn-secondary{
  display:inline-flex; align-items:center; gap:10px; padding:14px 28px;
  background:transparent; color:var(--ink); border:1px solid var(--border-3); border-radius:999px; font-size:15px; font-weight:500;
}
.file-size-note{ font-size:13px; color:var(--muted-3); margin-left:6px; }

/* archive toolbar */
.toolbar-section{ border-top:1px solid var(--border-1); background:var(--bg); }
.toolbar-inner{ padding-top:44px; }
.toolbar-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:24px; flex-wrap:wrap; margin-bottom:26px; }
.toolbar-title{ font-family:'Kanit',serif; font-weight:600; font-size:30px; margin:0 0 6px; color:var(--ink-2); }
.toolbar-sub{ margin:0; font-size:14px; color:var(--muted-2); }
.toolbar-controls{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.search-box{ position:relative; }
.search-box .icon{ position:absolute; left:15px; top:50%; transform:translateY(-50%); color:var(--muted-5); font-size:15px; pointer-events:none; }
.search-box input{
  width:250px; padding:11px 16px 11px 36px; background:#fff; border:1px solid var(--border-2);
  border-radius:999px; font-size:14px; color:var(--ink); outline:none;
}
.pill-select{
  padding:11px 16px; background:#fff; border:1px solid var(--border-2); border-radius:999px;
  font-size:14px; color:var(--ink); outline:none; cursor:pointer;
}

/* grid */
.grid-section{ padding-top:8px; padding-bottom:100px; }
.issue-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:44px 32px; }
@media (max-width: 860px){ .issue-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width: 520px){ .issue-grid{ grid-template-columns:1fr; } }
.issue-card{ display:flex; flex-direction:column; }
.issue-cover{
  position:relative; border:1px solid var(--border-2); border-radius:4px;
  overflow:hidden; transition:transform .3s ease, box-shadow .3s ease;
}
.issue-cover:hover{ transform:translateY(-6px); box-shadow:0 22px 40px -20px rgba(60,44,30,0.4); }
.issue-cover img{ width:100%; height:auto; display:block; }
.issue-body{ margin-top:14px; }
.issue-tags{ display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.issue-date{ font-size:11px; letter-spacing:0.1em; text-transform:uppercase; color:var(--muted-4); }
.issue-dot{ width:3px; height:3px; border-radius:50%; background:#D8CBB9; }
.issue-cat{ font-size:11px; color:var(--accent); font-weight:500; }
.issue-title{ font-family:'Kanit',serif; font-weight:600; font-size:17px; line-height:1.35; margin:0 0 10px; color:var(--ink); }
.issue-links{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.issue-links a{ display:inline-flex; align-items:center; padding:8px 16px; border-radius:999px; font-size:13px; font-weight:500; }
.issue-links a.read{ background:var(--accent-solid); color:#fff; }
.issue-links a.read:hover{ background:var(--accent-hover); color:#fff; }
.issue-links a.download{ background:transparent; border:1px solid var(--border-3); color:var(--ink); }
.issue-links a.download:hover{ background:var(--card-tint-1); color:var(--ink); }

/* pagination */
.pagination{ display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:8px; margin-top:56px; }
.page-link{
  min-width:42px; height:42px; padding:0 15px; display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--border-2); border-radius:999px; font-size:14px; color:var(--muted-1); background:#fff;
  transition:border-color .2s ease, color .2s ease;
}
.page-link:hover{ border-color:var(--accent); color:var(--accent); }
.page-link.current{ background:var(--ink); color:var(--bg); border-color:var(--ink); }
.page-link.disabled{ opacity:.4; pointer-events:none; }

.empty-state{ text-align:center; padding:90px 20px; }
.empty-title{ font-family:'Kanit',serif; font-size:24px; color:var(--ink); margin-bottom:10px; }
.empty-sub{ font-size:14px; color:var(--muted-2); margin:0 0 22px; }
.btn-dark{ padding:11px 24px; background:var(--ink); color:var(--bg); border:none; border-radius:999px; font-size:14px; font-weight:500; cursor:pointer; }

/* footer */
.site-footer{ border-top:1px solid var(--border-1); background:var(--footer-bg); }
.site-footer .inner{ padding-top:48px; padding-bottom:48px; display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:24px; }
.footer-brand{ font-family:'Kanit',serif; font-weight:700; font-size:22px; color:var(--ink); margin-bottom:8px; }
.footer-desc{ margin:0; font-size:13px; color:var(--muted-2); max-width:380px; line-height:1.7; }
.footer-copy{ font-size:12px; color:var(--muted-3); }

/* admin */
.admin-shell{ max-width:900px; margin:0 auto; padding:40px 24px 100px; }
.admin-card{ background:#fff; border:1px solid var(--border-2); border-radius:8px; padding:32px; margin-bottom:24px; }
.field{ margin-bottom:18px; }
.field label{ display:block; font-size:13px; font-weight:600; color:var(--muted-1); margin-bottom:6px; }
.field input[type=text], .field input[type=number], .field input[type=password], .field select, .field textarea{
  width:100%; padding:11px 14px; border:1px solid var(--border-2); border-radius:6px; font-size:14px; color:var(--ink); outline:none;
}
.field textarea{ resize:vertical; min-height:90px; }
.admin-table{ width:100%; border-collapse:collapse; font-size:14px; }
.admin-table th, .admin-table td{ text-align:left; padding:10px 12px; border-bottom:1px solid var(--border-1); }
.admin-table th{ color:var(--muted-2); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.05em; }
.admin-topbar{ display:flex; justify-content:space-between; align-items:center; margin-bottom:24px; }
.alert{ padding:12px 16px; border-radius:6px; font-size:14px; margin-bottom:18px; }
.alert-error{ background:#FBE4DC; color:#8A2F17; }
.alert-success{ background:#E3EFE0; color:#2C5B22; }
.cover-preview{ width:140px; border:1px solid var(--border-2); border-radius:4px; overflow:hidden; background:var(--card-tint-1); margin-bottom:10px; }
.cover-preview img{ width:100%; height:auto; display:block; }

/* flipbook viewer */
.viewer-shell{ background:#2B2622; min-height:100vh; display:flex; flex-direction:column; }
.viewer-topbar{ display:flex; align-items:center; justify-content:space-between; padding:16px 28px; color:#EFE8DE; }
.viewer-topbar a{ color:#EFE8DE; }
.viewer-stage{ flex:1; display:flex; align-items:center; justify-content:center; overflow:auto; padding:20px; }
.viewer-controls{ display:flex; align-items:center; justify-content:center; gap:18px; padding:16px; color:#EFE8DE; }
.viewer-controls button{
  background:#3A342E; color:#EFE8DE; border:1px solid #554D42; border-radius:999px;
  padding:8px 18px; font-size:14px; cursor:pointer;
}
.viewer-controls button:disabled{ opacity:.4; cursor:default; }

/* ---- mobile / responsive ---- */

/* tablet: shrink the oversized hero headline once it stacks to one column */
@media (max-width: 860px){
  .hero{ padding-top:56px; padding-bottom:48px; }
  .hero-title{ font-size:40px; }
  .hero-cover{ max-width:300px; }
}

@media (max-width: 640px){
  .wrap{ padding-left:24px; padding-right:24px; }

  /* header */
  .site-header .inner{ height:60px; }
  .brand-logo{ width:32px; height:32px; }
  .brand-th{ font-size:20px; }
  .brand-en{ display:none; }
  .site-nav{ gap:16px; font-size:13px; }

  /* hero */
  .hero{ padding-top:36px; padding-bottom:40px; }
  .hero .eyebrow{ margin-bottom:24px; }
  .hero-grid{ gap:28px; }
  .hero-cover{ max-width:220px; margin:0 auto; }
  .hero-title{ font-size:30px; margin-bottom:16px; }
  .hero-desc{ font-size:15px; margin-bottom:26px; }
  .hero-actions{ gap:12px; }
  .btn-primary, .btn-secondary{ padding:12px 22px; font-size:14px; }
  .file-size-note{ margin-left:0; width:100%; }

  /* archive toolbar — stack heading above full-width controls */
  .toolbar-inner{ padding-top:32px; }
  .toolbar-head{ flex-direction:column; align-items:stretch; gap:16px; }
  .toolbar-title{ font-size:24px; }
  .toolbar-controls{ width:100%; }
  .search-box{ flex:1 1 auto; }
  .search-box input{ width:100%; }
  .pill-select{ flex:0 0 auto; }

  .grid-section{ padding-top:8px; padding-bottom:60px; }
  .pagination{ margin-top:40px; gap:6px; }
  .page-link{ min-width:38px; height:38px; padding:0 12px; font-size:13px; }

  /* footer */
  .site-footer .inner{ padding-top:32px; padding-bottom:32px; }
  .footer-desc{ max-width:none; }

  /* flipbook viewer topbar */
  .viewer-topbar{ padding:12px 16px; font-size:14px; gap:12px; }
}

/* very small phones */
@media (max-width: 380px){
  .site-nav{ gap:10px; font-size:11px; }
  .brand{ gap:8px; }
  .brand-logo{ width:24px; height:24px; }
  .brand-th{ font-size:16px; white-space:nowrap; }
}
