/* tku10.net-foorumin arkisto. Värit foorumin omasta logosta (TKU10.NET Forum):
   hiilenharmaa #2f292b, punainen #ad2814, harmaa #737373 valkoisella.
   Tumma teema käyttäjän järjestelmäasetuksen mukaan. */

:root {
  --bg: #f4f3f1;
  --surface: #ffffff;
  --surface-2: #ecebe8;
  --line: #dcd9d4;
  --text: #2f292b;
  --muted: #6b6667;
  --accent: #ad2814;
  --accent-ink: #ffffff;
  --link: #ad2814;
  --link-hover: #7d1c0e;
  --quote-bg: #f7f6f4;
  --mark: rgba(173, 40, 20, 0.16);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Verdana, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b191a;
    --surface: #242122;
    --surface-2: #2e2a2b;
    --line: #3a3536;
    --text: #ece8e6;
    --muted: #a59e9d;
    --accent: #d2432a;
    --accent-ink: #ffffff;
    --link: #f08c74;
    --link-hover: #ffb4a2;
    --quote-bg: #201d1e;
    --mark: rgba(240, 140, 116, 0.28);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-wrap: break-word;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}
a:hover {
  color: var(--link-hover);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.25;
  text-wrap: balance;
}
h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
  margin: 0.4em 0 0.2em;
}
h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}
.muted {
  color: var(--muted);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 16px;
  top: 8px;
  z-index: 10;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 6px 10px;
}

/* ------------------------------------------------------------ header */

/* The logo is a GIF on white, so the header stays white in both themes. */
.top {
  background: #ffffff;
  border-bottom: 3px solid #ad2814;
  color: #2f292b;
}
.top-inner {
  display: flex;
  gap: 16px 24px;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.logo img {
  display: block;
  width: min(340px, 100%);
  height: auto;
}
.logo {
  flex: 0 1 340px;
}
.top-side {
  flex: 1 1 320px;
  display: grid;
  gap: 8px;
}
.tagline {
  font-family: var(--mono);
  color: #737373;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.top nav {
  display: flex;
  gap: 4px 18px;
  flex-wrap: wrap;
}
.top nav a {
  color: #2f292b;
  text-decoration: none;
  font-weight: 600;
}
.top nav a:hover {
  color: #ad2814;
  text-decoration: underline;
}

form.quick,
form.big-search {
  display: flex;
  gap: 6px;
}
input,
select,
button {
  font: inherit;
  color: inherit;
}
input[type="search"],
input:not([type]),
select {
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.top input[type="search"] {
  border-color: #cfcbc5;
  background: #ffffff;
  color: #2f292b;
}
.top button {
  background: #ad2814;
  color: #ffffff;
}
button {
  padding: 8px 16px;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
}
button:hover {
  filter: brightness(1.08);
}

main {
  padding-bottom: 48px;
}

.bottom {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 16px 0 32px;
}
.bottom .by {
  margin-top: 12px;
}
.bottom .pilvia {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
}
.bottom .pilvia:hover {
  color: var(--text);
}
.bottom .pilvia svg {
  flex: none;
}

/* ------------------------------------------------------------ home */

.hero {
  padding: 24px 0 8px;
}
.lead {
  font-size: 1.1rem;
  max-width: 62ch;
}
.big-search {
  max-width: 620px;
  margin-top: 16px;
}
.big-search input {
  padding: 12px 14px;
  font-size: 1.05rem;
}

.forums {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.forum-card {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
}
.forum-card:hover {
  border-color: var(--accent);
  color: var(--text);
}
.forum-name {
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--link);
}
.forum-meta,
.forum-last {
  color: var(--muted);
  font-size: 0.9rem;
}
.forum-last {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  gap: 6px;
  align-items: end;
  height: 200px;
}
.bars li {
  height: 100%;
}
.bars a {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
}
.bars .bar {
  width: 100%;
  height: calc(var(--h) * 0.75);
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  order: 2;
}
.bars .n {
  order: 1;
  font-variant-numeric: tabular-nums;
}
.bars .y {
  order: 3;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.bars a:hover .bar {
  background: var(--link-hover);
}
@media (max-width: 560px) {
  .bars .n {
    display: none;
  }
  .bars .y {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }
}

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 32px;
}
.mini {
  margin: 0;
  padding-left: 1.4em;
}
.mini li {
  margin-bottom: 8px;
}
.mini .muted {
  display: block;
  font-size: 0.85rem;
}

/* ------------------------------------------------------------ crumbs, pager */

.crumbs ol {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}
.crumbs li + li::before {
  content: "›";
  margin-right: 4px;
}
.crumbs li:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40ch;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 16px 0;
}
.pager ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.pager li a,
.pager li span {
  display: inline-block;
  min-width: 2.2em;
  padding: 4px 8px;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.pager li [aria-current] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}
.pager li.gap {
  padding: 4px 2px;
  color: var(--muted);
}
.pager .step {
  text-decoration: none;
  font-weight: 600;
}
.pager .off {
  color: var(--muted);
  opacity: 0.5;
}

/* ------------------------------------------------------------ topic list */

.topics {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.topics li {
  display: grid;
  grid-template-columns: 1fr 130px 130px;
  gap: 4px 16px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.topics li.pinned {
  background: var(--surface);
}
.t-main {
  min-width: 0;
}
.t-title {
  font-weight: 600;
  margin-right: 6px;
}
.t-by {
  display: block;
  font-size: 0.88rem;
}
.t-num,
.t-last {
  display: grid;
  font-size: 0.88rem;
  align-content: start;
}
.t-num strong {
  font-variant-numeric: tabular-nums;
}
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  vertical-align: 2px;
  margin-right: 4px;
}
.muted-badge {
  background: var(--surface-2);
  color: var(--muted);
}
@media (max-width: 640px) {
  .topics li {
    grid-template-columns: 1fr 1fr;
  }
  .t-main {
    grid-column: 1 / -1;
  }
  .t-num,
  .t-last {
    display: flex;
    gap: 8px;
  }
}

/* ------------------------------------------------------------ topic */

.topic-title {
  margin-top: 8px;
}
.topic-meta {
  margin-top: 0;
}

.poll {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px 8px;
  margin: 16px 0;
}
.poll h2 {
  font-size: 1.05rem;
  margin: 12px 0;
}
.poll ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.poll li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--mark) var(--w), transparent var(--w));
  border: 1px solid var(--line);
}
.poll .votes {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.posts {
  display: grid;
  gap: 12px;
}
.post {
  display: grid;
  grid-template-columns: 150px 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  scroll-margin-top: 16px;
}
.post:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.who {
  padding: 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
}
.who-text {
  display: grid;
  min-width: 0;
}
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}
.avatar.initial {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--muted);
  font-family: var(--mono);
}
.name {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.name.guest {
  color: var(--muted);
}
.rank {
  font-size: 0.78rem;
  color: var(--muted);
}
.post-body {
  min-width: 0;
  padding: 10px 16px 14px;
}
.post-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  font-size: 0.88rem;
  color: var(--muted);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.post-head .when {
  color: var(--muted);
  text-decoration: none;
}
.post-head .when:hover {
  text-decoration: underline;
}
.post-head .subject {
  font-weight: 600;
  color: var(--text);
}
.post-head .nth {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.edited {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}
@media (max-width: 640px) {
  .post {
    grid-template-columns: 1fr;
  }
  .who {
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }
  .avatar {
    width: 40px;
    height: 40px;
  }
}

.content > :first-child {
  margin-top: 0;
}
.content > :last-child {
  margin-bottom: 0;
}
.content p {
  margin: 0 0 0.8em;
}
.content a {
  overflow-wrap: anywhere;
}
.content blockquote {
  margin: 0 0 0.8em;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--quote-bg);
  border-radius: 0 6px 6px 0;
  font-size: 0.95em;
}
.content blockquote blockquote {
  border-left-color: var(--line);
}
.content blockquote p:first-child strong:only-child {
  color: var(--muted);
  font-size: 0.9em;
}
.content pre {
  overflow-x: auto;
  padding: 10px 12px;
  background: var(--quote-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 0.88rem/1.5 var(--mono);
}
.content img.ext {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  vertical-align: middle;
}
.content img.smiley {
  vertical-align: -3px;
}
.content ul,
.content ol {
  padding-left: 1.4em;
}
.img-missing {
  display: inline-block;
  padding: 4px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 560px;
  margin: 0 0 0.8em;
  border-radius: 8px;
  background: #000;
  overflow: hidden;
}
.video > a {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  background: radial-gradient(circle, #2a2a2a 0%, #000 75%);
}
.video > a::before {
  content: "";
  width: 64px;
  height: 44px;
  border-radius: 12px;
  background: #d00 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 7v10l8-5z'/%3E%3C/svg%3E") center / 28px no-repeat;
}
.video > a::after {
  content: "Klikkaa ladataksesi YouTubesta";
  font-weight: 400;
  font-size: 0.8rem;
  opacity: 0.75;
}
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.back {
  margin-top: 24px;
}

/* ------------------------------------------------------------ search */

.search-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.search-form .q {
  grid-column: 1 / -1;
}
.field {
  display: grid;
  gap: 4px;
}
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.field input,
.field select {
  width: 100%;
}
.field.q input {
  font-size: 1.1rem;
  padding: 10px 12px;
}

.results {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 10px;
}
.result {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.r-title {
  font-weight: 700;
  font-size: 1.05rem;
}
.r-meta {
  font-size: 0.85rem;
  color: var(--muted);
}
.r-excerpt {
  margin: 6px 0 0;
}
mark {
  background: var(--mark);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.prose {
  max-width: 66ch;
}
