/* Trang phụ: Bảng vàng, Góc học tập, trang biên tập cục bộ.
   Nạp sau styles.css: dùng chung tokens, reset, .site-header và focus của trang chủ. */

.subpage [hidden] { display: none !important; }

.sub-wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }

/* ---------- Màn đầu trang phụ ---------- */
.sub-hero { background: var(--paper); border-bottom: 1px solid var(--rule); overflow: clip; }
.sub-hero > .sub-wrap {
  display: grid; gap: 1.75rem;
  padding-block: clamp(1.75rem, 4vw, 2.5rem) clamp(2.25rem, 5vw, 3rem);
}
.sub-hero h1 {
  max-width: 20ch; margin: 0;
  font-size: clamp(2rem, 5.2vw + .65rem, 2.6rem); line-height: 1.1; letter-spacing: -.02em; color: var(--ink);
}
.sub-hero p { max-width: 33rem; margin: 1rem 0 0; font-size: 1.08rem; color: var(--ink-soft); }
.sub-cover-copy { animation: rise .48s var(--ease-out) both; }
.sub-cover-copy .sub-btn { margin-top: 1.4rem; }

/* Khung ảnh: khối navy bo góc lệch phía sau, viền hồng lệch lên trên như ảnh mặt tiền trang chủ */
.sub-cover-photo {
  position: relative; isolation: isolate; margin: 0; padding: .85rem .85rem 0 0;
  animation: rise .48s var(--ease-out) .1s both;
}
.sub-cover-photo::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 20% 22%;
  border-radius: 26px 26px 26px 46%; background: var(--navy);
  box-shadow: 8px -7px 0 0 #F8CCD4;
}
.sub-cover-photo img {
  width: 100%; height: auto; border-radius: var(--radius-lg);
  background: var(--paper-2); box-shadow: 0 16px 32px -24px #142d5170;
}

@media (min-width: 900px) {
  .sub-hero > .sub-wrap { padding-block: clamp(2.75rem, 5vw, 4rem); }
  .sub-hero .sub-cover {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center;
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
  }
  .sub-hero h1 { font-size: clamp(2.8rem, 3.6vw + .5rem, 3.9rem); }
  .sub-hero p { font-size: 1.15rem; }
  .sub-cover-photo { padding: 1.2rem 1.15rem 0 0; }
  .sub-cover-photo::before { inset: 0 0 14% 26%; border-radius: 36px 36px 36px 50%; box-shadow: 10px -8px 0 0 #F8CCD4; }
  .sub-cover-photo img { width: 92%; }
}

/* ---------- Thân trang ---------- */
.sub-body { padding-block: clamp(2.75rem, 6vw, 4.5rem); }
.sub-section { min-width: 0; }
.sub-section + .sub-section { margin-top: clamp(3rem, 7vw, 4.5rem); }
.sub-section h2 { margin-bottom: .5rem; }
.sub-section > p { max-width: 65ch; color: var(--ink-soft); }
.sub-help, .sub-status { margin: 0; font-size: .94rem; color: var(--ink-soft); }
.sub-help { max-width: 70ch; }
.sub-status { min-height: 1.5em; font-variant-numeric: tabular-nums; }
.sub-body > .sub-status + :is(.post-grid, .editor) { margin-top: .75rem; }

/* Nút: cùng hình viên thuốc với .btn và .btn-line của trang chủ */
.sub-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 48px; padding: .7rem 1.4rem;
  background: var(--red); color: var(--white); border: 1px solid var(--red); border-radius: 999px;
  font: 600 1rem/1.3 var(--sans); text-decoration: none; text-align: center; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, translate .2s var(--ease-out);
}
.sub-btn:hover { background: var(--red-deep); border-color: var(--red-deep); color: var(--white); text-decoration: none; }
.sub-btn.secondary { background: var(--white); color: var(--ink); border-color: var(--ink); }
.sub-btn.secondary:hover { background: var(--ink); border-color: var(--ink); color: var(--white); }

/* ---------- Thẻ ảnh và bài viết: phiếu trắng có lề trong như .record ---------- */
.feature-grid, .post-grid {
  display: grid; gap: clamp(1rem, 2vw, 1.4rem);
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
}
.feature-grid { margin-top: 1.25rem; }
.post-grid { grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); }
.post-grid:has(details[open]) { align-items: start; }

.feature-card, .post-card {
  display: flex; flex-direction: column; min-width: 0; padding: .6rem;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
  transition: translate .24s var(--ease-out), box-shadow .24s ease;
}
.feature-card img, .post-card img { width: 100%; border-radius: 7px; background: var(--paper-2); }
.feature-card img { aspect-ratio: 4 / 3; object-fit: contain; }
.post-card > img { aspect-ratio: 16 / 10; object-fit: cover; }
.feature-card:is(:target, .is-linked) { outline: 2px solid var(--red); outline-offset: 4px; }
.feature-card:focus { outline: none; }
.feature-card:is(:target, .is-linked):focus { outline: 2px solid var(--red); }
.award-photo-link { display: block; border-radius: 7px; }
.award-photo-link:focus-visible { outline-offset: -3px; }

.feature-card > div, .post-main { display: flex; flex: 1; flex-direction: column; padding: .9rem .75rem .65rem; }
.feature-card h3 { font: 600 clamp(1.15rem, .9vw + .8rem, 1.32rem)/1.3 var(--serif); overflow-wrap: anywhere; }
.feature-card h3::before { content: ""; display: block; width: 22px; height: 3px; margin-bottom: .55rem; background: var(--coral); }
.feature-card p { margin: .3rem 0 0; color: var(--ink-soft); font-size: .95rem; line-height: 1.55; }
.award-year { display: block; margin-top: .35rem; color: var(--red-deep); font-size: .88rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.student-name {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--red); font: inherit; text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em;
}
.student-name:hover { color: var(--navy); text-decoration-thickness: 2px; }

.award-board-members { margin-top: auto; padding-top: .6rem; }
.award-board-members summary {
  display: list-item; min-height: 44px; padding: .6rem 0; border-top: 1px solid var(--rule);
  color: var(--red); font-size: .92rem; font-weight: 600; cursor: pointer;
}
.award-members { list-style: none; margin: .5rem 0 0; padding: .35rem 0 0; border-top: 1px solid var(--rule); }
.award-board-members .award-members { margin: 0; padding: 0; border: 0; }
.award-members li { display: grid; gap: 0; padding-bottom: .25rem; }
.award-members span { color: var(--ink-soft); font-size: .88rem; line-height: 1.45; }

.post-category { margin-bottom: .35rem; color: var(--red-deep); font-size: .88rem; font-weight: 600; }
.post-main h2 { margin: 0 0 .5rem; font-size: clamp(1.25rem, 1.1vw + .8rem, 1.5rem); line-height: 1.25; letter-spacing: -.005em; }
.post-main > p { margin: 0; color: var(--ink-soft); }
.post-main details { margin-top: auto; padding-top: .75rem; }
.post-card summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 44px; border-top: 1px solid var(--rule); padding-top: .25rem;
  color: var(--red); font-weight: 600; list-style: none; cursor: pointer;
}
.post-card summary::-webkit-details-marker { display: none; }
.post-card summary::after { content: "+"; font-size: 1.25rem; line-height: 1; }
.post-card details[open] > summary::after { content: "−"; }
.post-card summary:hover { color: var(--red-deep); }
.post-card details p { max-width: 65ch; margin: .75rem 0 0; color: var(--ink); }

/* ---------- Phân trang ---------- */
.catalog-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .35rem; margin-top: 1.5rem; }
.catalog-pagination + .feature-grid { margin-top: 1rem; }
.catalog-pagination button {
  min-width: 44px; min-height: 44px; padding: 0 .65rem;
  background: var(--white); color: var(--navy); border: 1px solid var(--rule-strong); border-radius: 999px;
  font: 600 1rem/1 var(--sans); font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.catalog-pagination button:hover:not(:disabled) { background: var(--rose); border-color: var(--red); color: var(--red); }
.catalog-pagination button[aria-current="page"] { background: var(--red); border-color: var(--red); color: var(--white); }
.catalog-pagination button:disabled { cursor: default; opacity: .4; }
.catalog-pagination span { padding: 0 .15rem; color: var(--ink-soft); }

/* ---------- Tra cứu: khối nền xanh nhạt như .cambridge ---------- */
.sub-section:has(> .catalog-controls) {
  padding: clamp(1.25rem, 3.5vw, 2.25rem);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg);
}
.catalog-controls, .edit-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; }
.catalog-controls { margin: 1rem 0 1.1rem; }
.catalog-controls .field { flex: 1 1 14rem; }
label.field { display: grid; gap: .3rem; min-width: 0; max-width: 100%; font-weight: 600; }
.field :is(input, select, textarea) {
  width: 100%; min-height: 48px; padding: .55rem .75rem;
  background: var(--white); color: var(--ink); border: 1px solid var(--field); border-radius: 6px;
  font: 400 1rem/1.5 var(--sans);
}
.field textarea { resize: vertical; line-height: 1.6; }
.field :is(input, select, textarea):focus-visible { outline-offset: 1px; border-color: var(--ink-blue); }

.award-list { list-style: none; margin: .5rem 0 0; padding: 0; border-bottom: 1px solid var(--rule-strong); }
.award-list > li {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .75rem;
  padding: .35rem 0; border-top: 1px solid var(--rule-strong);
}
.award-list a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.award-list span { color: var(--ink-soft); font-size: .92rem; }
.award-search-group { margin-left: auto; font-size: .92rem; }
.award-search-group[open] { flex-basis: 100%; }
.award-search-group summary { display: list-item; min-height: 44px; padding: .65rem 0; color: var(--red); font-weight: 600; cursor: pointer; }
.award-search-group ul { list-style: none; margin: 0 0 .5rem; padding: 0 0 0 .9rem; border-left: 2px solid #F3C7D0; }
.award-search-group li a { min-height: 40px; font-weight: 500; }
.award-search-more { margin-top: 1.1rem; }

/* ---------- Hồ sơ học viên (dialog) ---------- */
.student-dialog {
  width: min(56rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0;
  background: var(--white); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius-lg);
}
.student-dialog[open] { animation: dialog-in .22s var(--ease-out) both; }
.student-dialog::backdrop { background: #142d51b3; }
.student-dialog-header {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem); background: var(--paper); border-bottom: 1px solid var(--rule);
}
.student-dialog-header h2 { margin: 0; font-size: clamp(1.5rem, 2.5vw + .9rem, 2.1rem); overflow-wrap: anywhere; }
.student-dialog-header p { margin: .3rem 0 0; color: var(--ink-soft); font-size: .95rem; }
.student-close {
  flex: 0 0 44px; height: 44px; padding: 0;
  background: var(--white); color: var(--navy); border: 1px solid var(--rule-strong); border-radius: 50%;
  font: 400 1.5rem/1 var(--sans); cursor: pointer;
}
.student-close:hover { background: var(--navy); border-color: var(--navy); color: var(--white); }
.student-awards { display: grid; gap: .65rem; padding: clamp(.85rem, 3vw, 1.4rem); }
.student-award { background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius); }
.student-award[open] { border-color: var(--rule-strong); }
.student-award > summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; align-items: center; gap: .35rem .65rem;
  min-height: 54px; padding: .75rem .95rem; list-style: none; cursor: pointer;
}
.student-award > summary::-webkit-details-marker { display: none; }
.student-award > summary::after { content: "+"; grid-area: 1 / 3 / 3 / 4; color: var(--red); font-size: 1.2rem; text-align: center; }
.student-award[open] > summary::after { content: "−"; }
.student-award[open] > summary { border-bottom: 1px solid var(--rule); }
.student-award > summary:hover .student-award-title { color: var(--red); }
.student-award-title { grid-area: 1 / 1 / 2 / 2; font-weight: 600; line-height: 1.35; }
.student-award-meta {
  grid-area: 2 / 1 / 3 / 2; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .55rem;
  color: var(--ink-soft); font-size: .84rem;
}
.student-award-level { padding: .08rem .45rem; border-radius: 5px; background: var(--rose); color: var(--red-deep); font-weight: 600; }
.student-award-count { grid-area: 1 / 2 / 3 / 3; color: var(--ink-soft); font-size: .86rem; white-space: nowrap; }
.student-proofs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: .85rem; padding: .9rem; }
.student-proofs figure { margin: 0; padding: .45rem; border: 1px solid var(--rule); border-radius: var(--radius); }
.student-proofs img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 6px; background: var(--paper-2); }
.student-proofs figcaption { padding: .55rem .3rem .15rem; font-size: .92rem; line-height: 1.5; }

/* ---------- Biên tập cục bộ ---------- */
.editor { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(0, 2fr); gap: clamp(1.25rem, 4vw, 3rem); align-items: start; }
.editor-list { display: grid; gap: .5rem; align-content: start; min-width: 0; }
.editor-list [data-blog-list] .sub-btn {
  justify-content: flex-start; min-height: 44px; padding: .6rem .9rem;
  text-align: left; font-weight: 500; line-height: 1.35;
  color: var(--ink); border-color: var(--rule-strong); border-radius: var(--radius);
}
.editor-list [data-blog-list] .sub-btn:hover { background: var(--paper); color: var(--ink); border-color: var(--ink-blue); }
.editor-list .sub-btn[aria-pressed="true"] { background: var(--rose); border-color: var(--red); color: var(--red-deep); font-weight: 600; }
.editor form {
  display: grid; gap: .9rem; min-width: 0;
  padding: clamp(1.1rem, 3vw, 1.75rem); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg);
}
.editor form img { width: min(100%, 240px); max-height: 160px; object-fit: cover; border-radius: 7px; }
.editor .edit-actions { margin: 0; }

/* ---------- Chân trang phụ, theo .site-footer ---------- */
.sub-footer { background: var(--white); border-top: 1px solid var(--rule); padding-block: 1.75rem; }
.sub-footer .sub-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; }
.sub-footer p { margin: 0; color: var(--ink-soft); }
.sub-footer nav { display: flex; flex-wrap: wrap; column-gap: 1.25rem; }
.sub-footer a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* ---------- Chuyển động và màn hẹp ---------- */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .sub-btn:hover { translate: 0 -2px; box-shadow: 0 8px 20px -10px #86182c90; }
  .sub-btn.secondary:hover { box-shadow: none; }
  .feature-card:is(:hover, :focus-within), .post-card:is(:hover, :focus-within) { translate: 0 -4px; box-shadow: var(--shadow-lift); }
}
@media (max-width: 650px) {
  .editor { grid-template-columns: 1fr; }
  .award-search-group { margin-left: 0; }
}
@media (max-width: 420px) {
  .student-award > summary { grid-template-columns: minmax(0, 1fr) 18px; }
  .student-award > summary::after { grid-area: 1 / 2 / 4 / 3; }
  .student-award-count { grid-area: 3 / 1 / 4 / 2; }
}
