/* ============================================================
       DESIGN TOKENS
       ============================================================ */
:root {
      --bg:       #0b0b0b;
      --ink:      #f2f0ec;
      --muted:    rgba(242, 240, 236, 0.48);
      --faint:    rgba(242, 240, 236, 0.25);
      --hairline: rgba(242, 240, 236, 0.08);
      --rule:     rgba(242, 240, 236, 0.10);

      --font:       "Source Han Sans CN","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
      --font-brand: "Ms Madi",cursive;

      --nav-h: 56px;
      --ease:  cubic-bezier(0.22,1,0.36,1);
      --maxw:  1280px;
    }

                a:focus-visible,
    button:focus-visible {
      outline: 1px solid var(--muted);
      outline-offset: 4px;
    }

    /* ============================================================
       HERO
       ============================================================ */
    .hero {
      padding: calc(var(--nav-h) + 80px) 36px 56px;
      max-width: var(--maxw);
      margin: 0 auto;
    }

    .hero h1 {
      font-family: var(--font);
      font-size: 56px;
      font-weight: 400;
      letter-spacing: 0;
      line-height: 1.15;
      margin-bottom: 16px;
    }

    .hero h1 em {
      font-style: normal;
      color: var(--ink);
      position: relative;
    }

    .hero .sub {
      font-size: 15px;
      color: var(--muted);
      line-height: 1.8;
      max-width: 460px;
    }

    /* ============================================================
       PROJECTS — asymmetric grid
       ============================================================ */
    .projects {
      padding: 0 36px 100px;
      max-width: var(--maxw);
      margin: 0 auto;
    }

    .proj-grid {
      display: grid;
      grid-template-columns: repeat(12, minmax(0, 1fr));
      gap: 16px;
    }

    /* Card base */
    .proj-card {
      position: relative;
      display: flex;
      flex-direction: column;
      border: 1px solid var(--hairline);
      border-radius: 4px;background: rgba(242, 240, 236, 0.012);
      overflow: hidden;
      opacity: 0;
      transform: translateY(14px);
      transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), border-color 0.35s var(--ease), background-color 0.35s var(--ease);
    }

    .proj-card.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .proj-card:hover {
      border-color: var(--hairline);
      background-color: rgba(242, 240, 236, 0.012);
    }

    /* --- Sizing variants --- */
    .proj-card--lg  { grid-column: 1 / 8;  min-height: 420px; }
    .proj-card--md  { grid-column: span 5; min-height: 380px; }
    .proj-card--sm  { grid-column: span 4; min-height: 340px; }
    .proj-card--wide{ grid-column: span 8; min-height: 320px; }
    .proj-card--mini{ grid-column: span 3; min-height: auto; padding: 24px 24px 20px; }

    /* Offset: push to right edge */
    .proj-card--md.proj-card--offset  { grid-column: 8 / -1; }
    .proj-card--sm.proj-card--offset  { grid-column: 9 / -1; }

    /* --- Visual (image area) --- */
    .proj-card-visual {
      position: relative;
      overflow: hidden;
      aspect-ratio: auto;
      background: #0d0d0d;
      flex-shrink: 0;
    }

    .proj-card-visual img {
      display: block;
      width: 100%;
      height: auto;
      object-fit: contain;
      transition: opacity 0.5s var(--ease);
    }

    .proj-card:hover .proj-card-visual img {
      opacity: 1;
    }

    /* --- Body --- */
    .proj-card-body {
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding: 0 24px 24px;
      flex: 1;
      justify-content: space-between;
      align-items: flex-start;
      text-align: left;
    }

    .proj-card--lg .proj-card-body  { min-height: 88px; padding: 12px 18px; }
    .proj-card--mini .proj-card-body { padding: 0; }

    .proj-card-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      width: 100%;
    }

    .proj-card-top .proj-card-link { flex-shrink: 0; margin-top: 0; }

    .proj-card-bottom {
      display: flex;
      align-items: center;
      width: 100%;
      min-height: 32px;
    }

    .proj-card-bottom .proj-card-desc {
      min-width: 0;
      flex: 1;
    }

    .proj-card-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-top: 20px;
    }

    .proj-card--mini .proj-card-meta { margin-top: 0; }

    .proj-card-index {
      font-size: 11px;
      letter-spacing: 0.1em;
      color: var(--faint);
    }

    /* Status badges */
    .proj-status {
      font-size: 10px;
      letter-spacing: 0.08em;
      padding: 2px 10px;
      border-radius: 3px;border: 1px solid transparent;
    }

    .proj-status--live  { color: rgba(140,220,160,0.8); border-color: rgba(140,220,160,0.2); }
    .proj-status--wip   { color: rgba(220,190,120,0.8); border-color: rgba(220,190,120,0.2); }
    .proj-status--idea  { color: rgba(160,170,210,0.8); border-color: rgba(160,170,210,0.2); }

    .proj-card-title {
      font-size: 24px;
      font-weight: 400;
      letter-spacing: 0;
      line-height: 1.3;
      transition: opacity 0.3s;
    }

    .proj-card:hover .proj-card-title { opacity: 1; }

    .proj-card--mini .proj-card-title {
      font-size: 16px;
      margin-bottom: 2px;
    }

    .proj-card-desc {
      font-size: 13px;
      line-height: 1.8;
      color: var(--muted);
      flex: 1;
    }

    .proj-card--mini .proj-card-desc {
      font-size: 12px;
      color: var(--faint);
    }

    /* Tags */
    .proj-card-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 4px;
    }

    .proj-card-tags span {
      font-size: 10px;
      letter-spacing: 0.04em;
      padding: 2px 8px;
      border-radius: 3px;color: var(--faint);
      background: rgba(242, 240, 236, 0.04);
    }

    /* Link */
    .proj-card-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: var(--ink);
      padding: 6px 12px;
      border: 1px solid rgba(242, 240, 236, 0.18);
      border-radius: 999px;
      background: rgba(242, 240, 236, 0.04);
      margin-top: 8px;
      width: fit-content;
      transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
    }

    .proj-card-link:hover {
      color: var(--ink);
      border-color: rgba(242, 240, 236, 0.24);
      background: rgba(242, 240, 236, 0.04);
    }

    .proj-card-link--soon {
      font-size: 12px;
      color: var(--faint);
      padding: 0;
      border: 1px dashed rgba(242, 240, 236, 0.08);
      border-width: 0 0 1px;
      margin-top: 8px;
      width: fit-content;
      pointer-events: none;
    }

    /* ============================================================
       PROJECT PREVIEW — same reading panel as 数码科技
       ============================================================ */
    body.modal-open { overflow: hidden; }

    .article-modal {
      position: fixed;
      inset: 0;
      z-index: 1000;
      display: grid;
      place-items: center;
      padding: 32px;
      background: rgba(0, 0, 0, 0.72);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.28s var(--ease), visibility 0.28s;
    }

    .article-modal.is-open { opacity: 1; visibility: visible; }

    .article-dialog {
      position: relative;
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
      width: min(960px, calc(100vw - 96px));
      height: min(600px, calc(100dvh - 128px));
      overflow: hidden;
      background: #101010;
      border: 1px solid var(--hairline);
      border-radius: 14px;
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
      transform: translateY(12px) scale(0.985);
      transition: transform 0.32s var(--ease);
    }

    .article-modal.is-open .article-dialog { transform: translateY(0) scale(1); }

    .article-gallery {
      position: relative;
      min-width: 0;
      overflow: hidden;
      background: #080808;
      border-right: 1px solid var(--hairline);
    }

    .article-slide {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      margin: 0;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease;
    }

    .article-slide.is-active { opacity: 1; pointer-events: auto; }

    .article-slide img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: center;
      user-select: none;
      -webkit-user-drag: none;
    }

    .gallery-control,
    .modal-close {
      display: grid;
      place-items: center;
      width: 38px;
      height: 38px;
      border: 1px solid rgba(242, 240, 236, 0.2);
      border-radius: 50%;
      background: rgba(11, 11, 11, 0.56);
      color: var(--ink);
      transition: background 0.22s var(--ease), border-color 0.22s var(--ease);
    }

    .gallery-control svg,
    .modal-close svg {
      display: block;
      width: 16px;
      height: 16px;
      stroke: currentColor;
      stroke-width: 1.8;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .gallery-control:hover,
    .modal-close:hover { background: rgba(242, 240, 236, 0.14); border-color: var(--muted); }

    .gallery-control { position: absolute; top: 50%; z-index: 1; transform: translateY(-50%); }
    .gallery-prev { left: 18px; }
    .gallery-next { right: 18px; }

    .gallery-dots {
      position: absolute;
      z-index: 1;
      bottom: 20px;
      left: 50%;
      display: flex;
      gap: 8px;
      transform: translateX(-50%);
    }

    .gallery-dot {
      width: 7px;
      height: 7px;
      padding: 0;
      border: 0;
      border-radius: 50%;
      background: rgba(242, 240, 236, 0.38);
    }

    .gallery-dot.is-active { background: var(--ink); transform: scale(1.15); }

    .article-gallery.has-single-slide .gallery-control,
    .article-gallery.has-single-slide .gallery-dots { display: none; }

    .article-reading-shell { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #101010; }
    .article-reading { height: 100%; min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: rgba(242, 240, 236, 0.28) transparent; }

    .article-reading-head {
      position: absolute;
      inset: 0 0 auto;
      z-index: 3;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      height: 64px;
      padding: 0 16px;
      background: rgba(16, 16, 16, 0.7);
      border-bottom: 1px solid rgba(242, 240, 236, 0.08);
      backdrop-filter: blur(18px) saturate(125%);
      -webkit-backdrop-filter: blur(18px) saturate(125%);
    }

    .modal-close { font-size: 0; }
    .article-preview-title { min-width: 0; margin: 0; overflow: hidden; color: var(--ink); font-size: clamp(21px, 2.4vw, 30px); font-weight: 400; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.02em; }
    .article-copy { display: block; padding: 108px 42px 52px; font-size: 15px; line-height: 1.9; color: rgba(242, 240, 236, 0.72); white-space: pre-line; }
    .article-copy p { margin: 0 0 20px; }
    .article-copy h3 { margin: 38px 0 12px; color: var(--ink); font-size: 18px; font-weight: 400; line-height: 1.45; }
    .article-copy .article-ending { margin-top: 38px; color: var(--ink); font-size: 16px; }
    .article-copy strong { color: var(--ink); font-weight: 400; }
    .article-copy a { color: var(--ink); border-bottom: 1px solid rgba(242, 240, 236, 0.22); }
    .preview-features { margin: 0 0 30px; }
    .article-copy .preview-features-title { margin: 0 0 10px; color: var(--ink); font-size: 14px; font-weight: 400; }
    .preview-feature-group { margin: 18px 0 0; }
    .article-copy .preview-feature-group-title { margin: 0 0 7px; color: var(--ink); font-size: 13px; font-weight: 400; }
    .preview-features ul { margin: 0; padding-left: 20px; }
    .preview-features li { margin: 0 0 8px; }
    .article-copy .preview-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 28px; }
    .article-copy .preview-tag { padding: 3px 9px; border-radius: 3px; background: rgba(242, 240, 236, 0.06); color: var(--muted); font-size: 11px; line-height: 1.5; }
    .article-copy .preview-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      width: fit-content;
      margin-top: 0;
      padding: 6px 12px;
      border: 1px solid rgba(242, 240, 236, 0.18);
      border-radius: 999px;
      background: rgba(242, 240, 236, 0.04);
      color: var(--ink);
      font-size: 12px;
      line-height: 1.7;
      text-decoration: none;
      transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
    }

    .article-copy .preview-link:hover {
      border-color: rgba(242, 240, 236, 0.24);
      background: rgba(242, 240, 236, 0.04);
      color: var(--ink);
    }

    /* Compact grid for mini cards */
    .proj-grid--compact {
      margin-top: 16px;
      gap: 12px;
    }

    /* ============================================================
       RESPONSIVE
       ============================================================ */

    /* ≤1024px: 8-column grid */
    @media (max-width: 1024px) {
      .proj-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        gap: 14px;
      }

      .proj-card--lg    { grid-column: 1 / -1; min-height: auto; }
      .proj-card--md    { grid-column: span 4; min-height: auto; }
      .proj-card--sm    { grid-column: span 4; min-height: auto; }
      .proj-card--wide  { grid-column: span 5; min-height: auto; }
      .proj-card--mini  { grid-column: span 4; }

      .proj-card--md.proj-card--offset,
      .proj-card--sm.proj-card--offset {
        grid-column: span 4;
      }

      .proj-grid--compact {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }

      .article-dialog { grid-template-columns: minmax(0, 1fr) minmax(300px, 0.82fr); }
      .article-copy { padding-left: 30px; padding-right: 30px; padding-bottom: 42px; }
    }

    /* ≤768px: single column */
    @media (max-width: 768px) {
            .hero { padding: calc(var(--nav-h) + 48px) 20px 36px; }
      .hero h1 { font-size: 40px; }
      .hero .sub { font-size: 13px; }

      .projects { padding: 0 20px 72px; }

      .proj-grid {
        grid-template-columns: 1fr;
        gap: 12px;
      }

      .proj-card--lg,
      .proj-card--md,
      .proj-card--sm,
      .proj-card--wide,
      .proj-card--md.proj-card--offset,
      .proj-card--sm.proj-card--offset {
        grid-column: 1 / -1;
      }

      .proj-grid--compact {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
      }

      .proj-card--mini { grid-column: span 1; }

      .article-modal { padding: 24px 12px; }
      .article-dialog {
        grid-template-columns: 1fr;
        width: calc(100dvw - 48px);
        grid-template-rows: minmax(0, calc(75dvw - 36px)) minmax(0, 1fr);
        height: calc(100dvh - 48px);
        border-radius: 12px;
      }
      .article-gallery { aspect-ratio: 4 / 3; border-right: 0; border-bottom: 1px solid var(--hairline); border-top-left-radius: inherit; border-top-right-radius: inherit; touch-action: pan-y; }
      .modal-close { background: rgba(11, 11, 11, 0.7); }
      .article-preview-title { font-size: 21px; }
      .article-copy { padding: 88px 24px 36px; font-size: 14px; line-height: 1.85; }
      .gallery-prev { left: 12px; }
      .gallery-next { right: 12px; }
      .gallery-dots { bottom: 14px; }

      .proj-card-body { padding: 0 20px 20px; }
      .proj-card--lg .proj-card-body { padding: 12px 18px; }
      .proj-card-title { font-size: 19px; }
      .proj-card--mini .proj-card-title { font-size: 15px; }
      .proj-card-desc { font-size: 13px; }
      .proj-card-meta { margin-top: 16px; }

      .footer { padding: 28px 20px 32px; }
      .footer-inner { flex-direction: column; align-items: flex-start; }
    }

    @media (max-width: 480px) {
      .proj-grid--compact { grid-template-columns: 1fr; }
    }

    /* ============================================================
       PORTRAIT — match 数码科技 (reviews.html)
       ============================================================ */
    @media (orientation: portrait) {
      .article-dialog {
        height: calc(100dvh - 120px);
      }
      .proj-card-body {
        gap: 0px;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      .proj-card { opacity: 1; transform: none; transition: none !important; }
      .proj-card:hover .proj-card-title { opacity: 1; }
      .proj-card:hover .proj-card-visual img { opacity: 1; }
    }

.preview-body { white-space: pre-wrap; margin: 20px 0; }
.preview-meta { color: var(--muted); font-size: 13px; }
.preview-link { display: inline-flex; margin-right: 18px; }
