/* 建中創客社 CKCTC — workshop look: warm paper, ink outlines, safety-orange accent,
   hard offset shadows like parts laid out on a workbench. */

:root {
  --paper: #f6f4ee;
  --paper-2: #ffffff;
  --ink: #15171a;
  --ink-2: #4a4f57;
  --ink-3: #8a8f97;
  --line: #15171a;
  --soft-line: #dcd8cd;
  --orange: #ff5b1f;
  --orange-soft: #ffe3d6;
  --blue: #2453ff;
  --blue-soft: #e2e8ff;
  --green: #0f9d58;
  --red: #d93025;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lift: 7px 7px 0 var(--ink);
  --radius: 12px;
  --wrap: 1100px;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background-color: var(--paper);
  background-image: radial-gradient(var(--soft-line) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink); font: 400 16px/1.7 var(--sans);
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 900; letter-spacing: 0.01em; }
p { margin: 0 0 0.8em; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--paper-2); padding: 8px 12px; z-index: 50; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 2px solid var(--ink); }
.top-row { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.logo-mark { font: 700 15px/1 var(--mono); background: var(--ink); color: var(--orange); padding: 7px 9px; border-radius: 8px; letter-spacing: 0.06em; }
.logo-name { font-weight: 900; font-size: 18px; letter-spacing: 0.08em; }
.nav { display: flex; gap: 4px; order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding: 2px 4px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; font-weight: 700; font-size: 14.5px; padding: 7px 12px; border-radius: 999px; border: 2px solid transparent; white-space: nowrap; transition: background .25s var(--ease), border-color .25s var(--ease), transform .2s var(--ease); }
.nav a:hover { border-color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav a:active { transform: scale(.94); }
@media (min-width: 920px) { .nav { order: 0; width: auto; } }
.account { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; background: var(--orange-soft); display: grid; place-items: center; font-weight: 900; font-size: 14px; }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 700 14.5px/1 var(--sans); padding: 10px 16px; border-radius: 10px;
  border: 2px solid var(--ink); background: var(--paper-2); color: var(--ink); cursor: pointer; text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .2s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--orange); color: #fff; }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.small { padding: 6px 10px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.btn.danger { color: var(--red); }
.btn[disabled] { opacity: .5; pointer-events: none; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
input, textarea, select {
  font: 400 15px/1.5 var(--sans); padding: 10px 12px; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--paper-2); color: var(--ink); width: 100%;
}
textarea { min-height: 110px; resize: vertical; }
input[type="checkbox"] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; }

/* ---------- page parts ---------- */
main { flex: 1; padding: 32px 0 64px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(28px, 5vw, 44px); }
.kicker { font: 700 12px/1 var(--mono); color: var(--orange); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 22px; }
.tabs a { text-decoration: none; font-weight: 700; padding: 8px 14px; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper-2); transition: transform .2s var(--ease), background .2s; }
.tabs a[aria-current="page"] { background: var(--orange); color: #fff; }
.tabs a:active { transform: scale(.95); }

.card {
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; transition: transform .35s var(--spring), box-shadow .35s var(--spring);
  min-width: 0; overflow-wrap: anywhere;
}
a.card { display: block; text-decoration: none; }
a.card:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-lift); }
a.card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.card h3 { font-size: 19px; margin-bottom: 6px; }
.card .meta { font: 400 13px/1.5 var(--mono); color: var(--ink-2); margin-bottom: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.list { display: grid; gap: 16px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.row-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.row-actions .row-actions, li .row-actions { display: contents; }
.tag { display: inline-block; font: 700 12px/1 var(--mono); padding: 5px 8px; border-radius: 6px; border: 2px solid var(--ink); background: var(--blue-soft); }
.tag.orange { background: var(--orange-soft); }
.tag.green { background: #d7f5e5; }
.tag.red { background: #fde2e0; }
.empty { border: 2px dashed var(--ink-3); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--ink-3); background: color-mix(in srgb, var(--paper-2) 60%, transparent); }
.notice { border: 2px solid var(--ink); border-left-width: 8px; border-left-color: var(--orange); background: var(--paper-2); border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }

/* home */
.hero { padding: 36px 0 28px; }
.hero .kicker { margin-bottom: 22px; }
.hero h1 { font-size: clamp(38px, 8vw, 76px); line-height: 1.05; }
.hero h1 .hl { background: var(--orange); color: #fff; padding: 0 .18em; border-radius: 10px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hero p { font-size: 18px; color: var(--ink-2); margin-top: 16px; max-width: 32em; }
.modules { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin-top: 28px; }
.modules .card { min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; }
.modules .num { font: 700 13px/1 var(--mono); color: var(--orange); }
.modules h3 { font-size: 22px; }
.section-title { font-size: 22px; margin: 40px 0 16px; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ""; width: 14px; height: 14px; background: var(--orange); border: 2px solid var(--ink); border-radius: 4px; }

/* about / contact */
.about-block { margin-bottom: 16px; }
.contact-methods { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.contact-methods li { display: flex; gap: 10px; align-items: baseline; }
.contact-methods li > :last-child { min-width: 0; overflow-wrap: anywhere; }
.contact-methods .k { font: 700 12px/1 var(--mono); min-width: 84px; color: var(--ink-2); text-transform: uppercase; }
.method-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; align-items: center; }

/* polls */
.poll-opt { position: relative; display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; margin-top: 8px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper-2); cursor: pointer; overflow: hidden; font: inherit; text-align: left; width: 100%; }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: var(--blue-soft); z-index: 0; transition: width .8s var(--ease); }
.poll-opt.mine .bar { background: var(--orange-soft); }
.poll-opt > span { position: relative; z-index: 1; }
.poll-opt[disabled] { cursor: default; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font: 700 12px/1 var(--mono); text-align: center; padding: 6px 0; color: var(--ink-2); }
.cal .day { min-height: 84px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 8px; padding: 4px; font-size: 12px; overflow: hidden; }
.cal .day.out { opacity: .35; }
.cal .day.today { background: var(--orange-soft); }
.cal .day .d { font: 700 12px/1 var(--mono); }
.cal .ev { display: block; margin-top: 3px; padding: 2px 4px; border-radius: 4px; font-size: 11px; line-height: 1.3; background: var(--blue-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.course { background: var(--orange-soft); }
.cal .ev.event { background: #d7f5e5; }
@media (max-width: 640px) { .cal .day { min-height: 56px; } .cal .ev { font-size: 0; height: 6px; padding: 0; } }

/* board & chat */
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 10px; }
.msg .who { font-weight: 700; font-size: 14px; }
.msg time { font: 400 12px var(--mono); color: var(--ink-3); margin-left: 8px; }
.chat { display: grid; gap: 12px; margin-bottom: 14px; }
.bubble { max-width: 85%; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { justify-self: end; background: var(--orange); color: #fff; border-bottom-right-radius: 4px; }
.bubble.assistant { background: var(--paper-2); border-bottom-left-radius: 4px; }
.bubble.thinking { color: var(--ink-3); }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.chat-form textarea { min-height: 52px; }

/* photos */
.album-cover { aspect-ratio: 4 / 3; border-radius: 8px; border: 2px solid var(--ink); background: var(--blue-soft) center / cover no-repeat; margin-bottom: 12px; }
.photo-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.photo { position: relative; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--blue-soft); aspect-ratio: 1; cursor: zoom-in; padding: 0; transition: transform .35s var(--spring), box-shadow .35s var(--spring); }
.photo:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .del { position: absolute; top: 6px; right: 6px; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(15, 16, 18, .92); display: grid; place-items: center; padding: 20px; animation: fade .3s var(--ease); }
.lightbox img { max-height: 86vh; border-radius: 10px; animation: zoom-in .45s var(--ease); }
.lightbox p { color: #fff; text-align: center; margin-top: 10px; }
.lightbox .close { position: absolute; top: 16px; right: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes zoom-in { from { opacity: 0; transform: scale(.94); } }

/* dialog form */
dialog { border: 2px solid var(--ink); border-radius: 16px; box-shadow: 8px 8px 0 var(--ink); padding: 0; width: min(560px, 100% - 24px); max-height: 90vh; background: var(--paper-2); color: var(--ink); }
dialog[open] { animation: pop .4s var(--spring); }
dialog::backdrop { background: rgba(21, 23, 26, .45); backdrop-filter: blur(3px); animation: fade .3s; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.dialog-body { padding: 22px; display: grid; gap: 14px; }
.dialog-body h2 { font-size: 22px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 70; transition: transform .45s var(--spring); max-width: calc(100% - 32px); }
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

/* page enter */
.enter > * { animation: enter .6s var(--ease) backwards; }
.enter > :nth-child(2) { animation-delay: .06s; }
.enter > :nth-child(3) { animation-delay: .12s; }
.enter > :nth-child(n+4) { animation-delay: .18s; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } }

.foot { border-top: 2px solid var(--ink); padding: 22px 0; font: 400 13px var(--mono); color: var(--ink-2); background: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
