/* =========================================================
   Shared design system — Nuno Pombo / UBI site
   Kinetic maximalist direction: oversized serif display type,
   purple/orange/yellow color-blocking, marquee tickers,
   ghosted background type, scroll-reveal motion.
   Used by: index.html, units/se.html, units/psx.html
   ========================================================= */

   :root {
    --ink: #140c24;
    --ink-2: #1c1030;
    --ink-3: #241539;
    --paper: #fbf7ef;
    --paper-card: #ffffff;
    --line: #e5ddc9;
    --text: #1c1030;
    --soft: #6a6079;
    --lav: #cabced;
    --lav-dim: #948aad;
    --orange: #ff5e3a;
    --orange-dark: #d43f1f;
    --yellow: #ffd23f;
    --maxw: 1180px;
    font-size: 16px;
  }
  
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  
  body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--paper);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }
  
  img { max-width: 100%; display: block; }
  
  a { color: inherit; }
  
  h1, h2, h3, h4 {
    font-family: "Fraunces", Georgia, "Times New Roman", serif;
    line-height: 1.05;
    margin: 0 0 .5em;
    font-weight: 700;
    letter-spacing: -0.015em;
  }
  
  .mono { font-family: "Space Mono", "DejaVu Sans Mono", monospace; }
  
  .wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }
  
  /* ---------- Scroll reveal ---------- */
  .reveal { opacity: 0; transform: translateY(28px); transition: opacity .6s ease, transform .6s ease; }
  .reveal.in { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
  }
  
  /* ---------- Top bar ---------- */
  .topbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--ink);
    border-bottom: 3px solid var(--orange);
  }
  .topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; }
  .brand { display: flex; align-items: center; gap: 12px; font-family: "Fraunces", serif; font-weight: 800; font-size: 1.2rem; color: #fff; text-decoration: none; }
  .brand img { height: 30px; width: auto; filter: brightness(0) invert(1); }
  .brand small { display: block; font-family: "Space Mono", monospace; font-weight: 400; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--lav-dim); margin-top: 3px; }
  
  .toplinks { display: flex; gap: 8px; align-items: center; }
  .toplinks a {
    font-family: "Space Mono", monospace;
    color: var(--lav);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
  }
  .toplinks a:hover { background: var(--orange); color: var(--ink); }
  .navtoggle { display: none; }
  
  @media (max-width: 780px) {
    .toplinks { position: fixed; inset: 72px 0 auto 0; background: var(--ink); flex-direction: column; align-items: stretch; gap: 4px; padding: 14px 24px 20px; border-bottom: 3px solid var(--orange); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all .18s ease; }
    .toplinks.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
    .toplinks a { padding: 12px 14px; }
    .navtoggle { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 2px solid var(--orange); border-radius: 10px; background: none; cursor: pointer; }
    .navtoggle span, .navtoggle span::before, .navtoggle span::after { content: ""; display: block; width: 18px; height: 2px; background: #fff; position: relative; }
    .navtoggle span::before { position: absolute; top: -6px; }
    .navtoggle span::after { position: absolute; top: 6px; }
  }
  
  /* ---------- Marquee ticker ---------- */
  .ticker { display: flex; overflow: hidden; background: var(--orange); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); position: relative; z-index: 2; }
  .ticker-track { display: flex; flex: none; width: max-content; animation: marquee 26s linear infinite; }
  .ticker.alt .ticker-track { animation-duration: 32s; animation-direction: reverse; }
  .ticker-track span {
    display: inline-flex; align-items: center; gap: 14px;
    padding: 14px 28px; white-space: nowrap;
    font-family: "Space Mono", monospace; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; font-size: .95rem; color: var(--ink);
  }
  .ticker.alt { background: var(--ink); border-color: var(--orange); }
  .ticker.alt .ticker-track span { color: var(--yellow); }
  @keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
  @media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }
  
  /* ---------- Hero (dark) ---------- */
  .hero {
    background: var(--ink);
    background-image: radial-gradient(circle at 15% 20%, rgba(255,94,58,0.18), transparent 45%), radial-gradient(circle at 88% 82%, rgba(255,210,63,0.12), transparent 45%);
    color: #fff;
    position: relative;
    overflow: hidden;
    padding: 56px 0 64px;
  }
  .ghost-word {
    position: absolute; top: -0.12em; left: -0.03em;
    font-family: "Fraunces", serif; font-weight: 900; font-style: italic;
    font-size: clamp(6rem, 19vw, 15rem); line-height: 1; color: rgba(255,255,255,.05);
    white-space: nowrap; pointer-events: none; user-select: none; z-index: 0;
  }
  .kicker-tag {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--yellow); color: var(--ink);
    font-family: "Space Mono", monospace; font-weight: 700; text-transform: uppercase;
    font-size: .74rem; letter-spacing: .06em; padding: 7px 16px;
    transform: rotate(-2deg); margin-bottom: 26px;
  }
  .hero-grid { display: grid; grid-template-columns: 1.35fr .9fr; gap: 40px; align-items: end; }
  .hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); color: #fff; margin-bottom: 22px; }
  .hero h1 em { font-style: italic; color: var(--yellow); }
  .hero .dek { font-size: 1.1rem; color: var(--lav); max-width: 540px; margin-bottom: 30px; }
  .hero .dek strong { color: #fff; }
  
  .hero-photo-wrap { position: relative; justify-self: end; }
  .hero-photo {
    width: 240px; height: 300px; object-fit: cover;
    border: 4px solid var(--orange);
    transform: rotate(3deg);
    box-shadow: -14px 14px 0 rgba(255,210,63,.35);
  }
  
  .btn-cta {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--yellow); color: var(--ink);
    font-family: "Inter", sans-serif; font-weight: 800; font-size: .92rem;
    padding: 16px 28px; border-radius: 999px; text-decoration: none;
    border: 3px solid var(--ink);
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 5px 5px 0 var(--orange);
  }
  .btn-cta:hover { transform: translate(-3px,-3px); box-shadow: 8px 8px 0 var(--orange); }
  .btn-cta.ghost { background: transparent; color: #fff; border-color: var(--lav-dim); box-shadow: none; }
  .btn-cta.ghost:hover { background: rgba(255,255,255,.08); transform: none; }
  
  @media (max-width: 760px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-photo-wrap { justify-self: center; margin-top: 10px; }
  }
  
  /* ---------- Sections ---------- */
  .section { padding: 76px 0; position: relative; }
  .section.light { background: var(--paper); }
  .section.dark { background: var(--ink); color: #fff; }
  .section.orange { background: var(--orange); color: var(--ink); }
  
  .section-head { margin-bottom: 44px; max-width: 780px; }
  .section-head h2 { font-size: clamp(2rem, 4.2vw, 3rem); }
  .section-head h2 em { color: var(--orange-dark); font-style: italic; }
  .section.dark .section-head h2 em, .section.dark .section-head h2 { color: #fff; }
  .section.dark .section-head h2 em { color: var(--yellow); }
  .section.orange .section-head h2 { color: var(--ink); }
  .section.orange .section-head h2 em { color: var(--paper); }
  .section-head p { color: var(--soft); margin: 16px 0 0; font-size: 1.02rem; max-width: 620px; }
  .section.dark .section-head p { color: var(--lav); }
  .section.orange .section-head p { color: rgba(20,12,36,.78); }
  
  .kicker-tag.on-light { background: var(--ink); color: var(--yellow); }
  
  p.lede-open::first-letter {
    font-family: "Fraunces", serif; font-size: 3.6em; font-weight: 800; font-style: italic;
    float: left; line-height: .8; padding: .05em .1em 0 0; color: var(--orange-dark);
  }
  
  /* ---------- Cards ---------- */
  .card { background: var(--paper-card); border: 2px solid var(--ink); }
  .card-pad { padding: 30px 32px; }
  .card h3 { font-size: 1.2rem; margin-bottom: 16px; }
  
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
  @media (max-width: 800px) { .cols-2 { grid-template-columns: 1fr; } }
  
  .col-head {
    font-family: "Space Mono", monospace; text-align: left; font-size: .74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--orange-dark);
    padding: 0 0 16px; margin: 0 0 18px; border-bottom: 3px solid var(--ink);
  }
  
  /* ---------- Timeline ---------- */
  .timeline { list-style: none; margin: 0; padding: 0; }
  .timeline li { position: relative; padding: 18px 0 18px 22px; border-left: 3px solid var(--line); }
  .timeline li:hover { border-left-color: var(--orange); }
  .timeline .when { font-family: "Space Mono", monospace; font-variant-numeric: tabular-nums; font-size: .76rem; font-weight: 700; letter-spacing: .03em; color: var(--orange-dark); }
  .timeline h4 { font-size: 1.08rem; margin: 5px 0 3px; }
  .timeline p { margin: 0; color: var(--soft); font-size: .92rem; }
  
  /* ---------- Honors ---------- */
  .honor { display: grid; grid-template-columns: 92px 1fr; gap: 24px; padding: 26px 0; border-bottom: 2px dashed var(--line); }
  .honor:first-child { padding-top: 0; }
  .honor:last-child { border-bottom: none; padding-bottom: 0; }
  .honor img { width: 92px; height: 92px; object-fit: contain; border: 2px solid var(--ink); padding: 8px; background: var(--paper-card); }
  .honor .honor-mono {
    width: 92px; height: 92px; border: 2px solid var(--ink); background: var(--paper-card);
    display: flex; align-items: center; justify-content: center;
    font-family: "Fraunces", serif; font-weight: 800; font-style: italic; font-size: 1.5rem; color: var(--orange-dark);
  }
  .honor .when { font-family: "Space Mono", monospace; font-size: .72rem; font-weight: 700; color: var(--orange-dark); text-transform: uppercase; letter-spacing: .06em; }
  .honor h4 { margin: 4px 0 8px; font-size: 1.15rem; }
  .honor p { margin: 0 0 10px; color: var(--soft); font-size: .93rem; }
  
  /* ---------- Text links / pills ---------- */
  .pillrow { display: flex; gap: 14px; flex-wrap: wrap; }
  .pill {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: "Inter", sans-serif; font-size: .86rem; font-weight: 700; color: var(--ink);
    text-decoration: none; background: var(--paper-card); border: 2px solid var(--ink);
    padding: 9px 18px; transition: transform .15s ease, box-shadow .15s ease;
  }
  .pill:hover { box-shadow: 4px 4px 0 var(--orange); transform: translate(-2px,-2px); }
  
  /* ---------- Teaching diptych ---------- */
  .diptych { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
  @media (max-width: 760px) { .diptych { grid-template-columns: 1fr; } }
  .diptych-panel {
    position: relative; overflow: hidden; min-height: 320px;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 34px; text-decoration: none; border: 3px solid var(--ink);
    transition: transform .2s ease, box-shadow .2s ease;
  }
  .diptych-panel.p1 {
    background: var(--orange);
    background-image: radial-gradient(circle at 88% 8%, rgba(255,255,255,.35), transparent 55%);
    color: var(--ink);
  }
  .diptych-panel.p2 {
    background: var(--ink);
    background-image: radial-gradient(circle at 85% 12%, rgba(255,94,58,.35), transparent 55%), radial-gradient(circle at 10% 90%, rgba(255,210,63,.14), transparent 50%);
    color: #fff;
  }
  .diptych-panel:hover { transform: translate(-5px,-5px); box-shadow: 8px 8px 0 var(--ink); }
  .diptych-panel.p2:hover { box-shadow: 8px 8px 0 var(--orange); }
  
  .diptych-panel::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background-image: radial-gradient(currentColor 1.5px, transparent 1.5px);
    background-size: 24px 24px;
  }
  .diptych-panel.p1::before { color: rgba(20,12,36,.15); }
  .diptych-panel.p2::before { color: rgba(255,255,255,.09); }
  
  .diptych-ghost {
    position: absolute; top: -0.16em; right: -0.04em; z-index: 0; pointer-events: none; user-select: none;
    font-family: "Fraunces", serif; font-weight: 900; font-style: italic;
    font-size: clamp(4.5rem, 15vw, 9.5rem); line-height: 1;
  }
  .diptych-panel.p1 .diptych-ghost { color: rgba(20,12,36,.16); }
  .diptych-panel.p2 .diptych-ghost { color: rgba(255,255,255,.08); }
  
  .diptych-art { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; transition: transform .5s ease; }
  .diptych-panel:hover .diptych-art { transform: scale(1.06) rotate(1deg); }
  .diptych-panel.p1 .diptych-art { color: rgba(20,12,36,0.32); }
  .diptych-panel.p2 .diptych-art { color: rgba(255,255,255,0.22); }
  .diptych-content { position: relative; z-index: 1; }
  .diptych-kicker { display: inline-block; font-family: "Space Mono", monospace; text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; font-weight: 700; margin-bottom: 12px; padding: 4px 10px; }
  .diptych-panel.p1 .diptych-kicker { background: var(--ink); color: var(--yellow); }
  .diptych-panel.p2 .diptych-kicker { background: var(--yellow); color: var(--ink); }
  .diptych-panel h3 { font-size: 1.9rem; margin: 0 0 18px; }
  .diptych-cta { display: inline-flex; align-items: center; gap: 8px; font-family: "Inter", sans-serif; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
  .diptych-cta .arrow { display: inline-block; transition: transform .2s ease; }
  .diptych-panel:hover .diptych-cta .arrow { transform: translateX(6px); }
  
  .course-row {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    padding: 22px 26px; border: 2px solid var(--ink); background: var(--paper-card);
  }
  .course-row .tag { font-family: "Space Mono", monospace; font-size: .68rem; font-weight: 700; letter-spacing: .06em; background: var(--yellow); color: var(--ink); padding: 4px 10px; }
  .course-row h4 { margin: 10px 0 3px; font-size: 1.15rem; }
  .course-row .meta { color: var(--soft); font-size: .86rem; }
  .course-row a.go {
    font-family: "Inter", sans-serif; display: inline-flex; align-items: center; gap: 8px;
    background: var(--ink); color: #fff; font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; padding: 12px 20px; text-decoration: none; flex: none;
  }
  .course-row a.go:hover { background: var(--orange-dark); }
  @media (max-width: 560px) { .course-row { flex-direction: column; align-items: flex-start; } .course-row a.go { align-self: stretch; justify-content: center; } }
  
  .topics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 28px; margin: 0; padding: 0; list-style: none; border-top: 2px solid var(--line); }
  .topics-grid li { padding: 15px 0 15px 26px; position: relative; color: var(--soft); font-size: .94rem; border-bottom: 2px solid var(--line); }
  .topics-grid li::before { content: "→"; position: absolute; left: 0; color: var(--orange-dark); font-weight: 700; }
  @media (max-width: 700px) { .topics-grid { grid-template-columns: 1fr; } }
  
  /* ---------- Contact ---------- */
  .contact-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 24px; align-items: stretch; }
  @media (max-width: 700px) { .contact-grid { grid-template-columns: 1fr; } }
  .contact-grid .card { background: var(--ink-2); border: 2px solid var(--ink); color: #fff; }
  .contact-list { list-style: none; margin: 0; padding: 30px 32px; display: grid; gap: 18px; font-family: "Inter", sans-serif; background: var(--paper-card); border: 2px solid var(--ink); color: var(--text); }
  .contact-list li { display: flex; align-items: center; gap: 14px; font-size: .94rem; }
  .contact-list a { color: var(--text); text-decoration: underline; text-decoration-color: var(--orange); }
  .contact-list a:hover { color: var(--orange-dark); }
  .contact-list .ico { width: 74px; flex: none; font-family: "Space Mono", monospace; text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; font-weight: 700; color: var(--orange-dark); }
  
  /* ---------- Footer ---------- */
  .footer { padding: 34px 0; text-align: center; color: var(--lav-dim); font-family: "Space Mono", monospace; font-size: .76rem; letter-spacing: .03em; background: var(--ink); }
  
  /* =========================================================
     Unit pages (se.html / psx.html)
     ========================================================= */
  .unit-badges { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
  .unit-badges .kicker-tag { margin-bottom: 0; }
  .unit-logo { height: 36px; width: auto; flex: none; padding: 7px 11px; background: var(--paper-card); border: 2px solid var(--ink); }
  .unit-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
  .unit-hero .code { color: var(--lav); font-size: 1rem; margin-top: 10px; }
  
  .tabnav { display: flex; gap: 10px; flex-wrap: wrap; margin: 30px 0 0; }
  .tabnav button {
    appearance: none; cursor: pointer; font: inherit;
    font-family: "Inter", sans-serif; font-weight: 700; font-size: .84rem; text-transform: uppercase; letter-spacing: .04em;
    padding: 12px 20px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper-card); color: var(--ink);
  }
  .tabnav button:hover { border-color: var(--orange-dark); }
  .tabnav button.active { background: var(--ink); color: var(--yellow); border-color: var(--ink); }
  
  .tabpanel { display: none; padding: 40px 0 68px; }
  .tabpanel.active { display: block; }
  
  .news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
  .news-item { display: flex; gap: 20px; align-items: flex-start; padding: 20px 24px; border: 2px solid var(--ink); background: var(--paper-card); }
  .news-date {
    font-family: "Space Mono", monospace; flex: none; font-weight: 700;
    background: var(--yellow); color: var(--ink); font-size: .78rem; letter-spacing: .02em; padding: 6px 10px; white-space: nowrap;
  }
  .news-item p { margin: 4px 0 0; }
  
  .syllabus-list { margin: 0; padding-left: 0; list-style: none; counter-reset: syl; }
  .syllabus-list li { margin-bottom: 16px; color: var(--soft); padding-left: 40px; position: relative; counter-increment: syl; }
  .syllabus-list li::before {
    content: counter(syl, decimal-leading-zero);
    position: absolute; left: 0; top: -.15em;
    font-family: "Space Mono", monospace; font-size: .95rem; font-weight: 700; color: #fff;
    background: var(--orange); padding: 2px 6px;
  }
  
  .biblio { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
  .biblio li { padding-left: 22px; position: relative; color: var(--soft); font-size: .93rem; }
  .biblio li::before { content: "—"; position: absolute; left: 0; color: var(--orange-dark); font-weight: 700; }
  
  table.notes { width: 100%; border-collapse: collapse; }
  table.notes th, table.notes td { padding: 16px 18px; text-align: left; border-bottom: 2px solid var(--line); vertical-align: top; }
  table.notes th { font-family: "Space Mono", monospace; border-bottom: 3px solid var(--ink); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--orange-dark); }
  table.notes td.week { font-family: "Space Mono", monospace; font-weight: 700; color: #fff; background: var(--ink); white-space: nowrap; width: 90px; font-size: .84rem; text-align: center; }
  table.notes tr:last-child td { border-bottom: none; }
  table.notes .empty { color: var(--lav-dim); }
  
  .doclink {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: "Inter", sans-serif; font-size: .72rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
    padding: 5px 11px; background: var(--orange); color: var(--ink);
    margin: 3px 6px 3px 0; text-decoration: none;
  }
  .doclink:hover { background: var(--ink); color: var(--yellow); }
  
  .grades-frame { border: 3px solid var(--ink); }
  .grades-frame embed { display: block; }

.hero-grid { grid-template-columns: 1.6fr .65fr; }   /* was 1.35fr .9fr — text gets more room */

.hero-photo {
  width: clamp(240px, 25vw, 360px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;

  border: none;
  box-shadow: none;
  transform: none;
}