/*
Theme Name: ComeTutorial SEO
Theme URI: https://www.cometutorial.it/
Author: Renato Cantarella
Author URI: https://www.renatocantarella.it/
Description: Tema editoriale leggero e responsive per guide tecnologiche, tutorial e soluzioni pratiche.
Version: 1.1.0
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: cometutorial
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

:root {
  --ct-primary: #155eef;
  --ct-primary-dark: #0b3da8;
  --ct-accent: #09a88e;
  --ct-ink: #14213d;
  --ct-muted: #5e6b85;
  --ct-surface: #ffffff;
  --ct-soft: #f4f7fb;
  --ct-border: #dbe3ef;
  --ct-warning: #ffb020;
  --ct-radius: 18px;
  --ct-shadow: 0 12px 34px rgba(20, 33, 61, .09);
  --ct-width: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ct-ink); background: #fff; font: 400 17px/1.72 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body.admin-bar .site-header { top: 32px; }
img { max-width: 100%; height: auto; }
a { color: var(--ct-primary); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--ct-primary-dark); }
button, input, select, textarea { font: inherit; }
.container { width: min(calc(100% - 40px), var(--ct-width)); margin-inline: auto; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.screen-reader-text:focus { position: fixed; z-index: 99999; top: 10px; left: 10px; width: auto; height: auto; padding: 12px 18px; clip: auto; background: #fff; color: var(--ct-ink); }

/* Header */
.site-header { position: sticky; z-index: 1000; top: 0; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--ct-border); backdrop-filter: blur(12px); }
.header-inner { min-height: 76px; display: flex; align-items: center; gap: 28px; }
.site-branding { margin-right: auto; }
.custom-logo { display: block; max-height: 48px; width: auto; }
.site-title { margin: 0; font-size: 1.45rem; font-weight: 850; letter-spacing: -.04em; }
.site-title a { color: var(--ct-ink); text-decoration: none; }
.site-title span { color: var(--ct-primary); }
.site-description { margin: -4px 0 0; color: var(--ct-muted); font-size: .76rem; }
.primary-menu { display: flex; align-items: center; gap: 22px; margin: 0; padding: 0; list-style: none; }
.primary-menu a { color: var(--ct-ink); font-size: .93rem; font-weight: 700; text-decoration: none; }
.primary-menu a:hover, .primary-menu .current-menu-item > a { color: var(--ct-primary); }
.menu-toggle, .search-toggle { border: 0; border-radius: 12px; background: var(--ct-soft); color: var(--ct-ink); cursor: pointer; padding: 10px 12px; }
.menu-toggle { display: none; }
.header-search { display: none; padding: 16px 0; border-top: 1px solid var(--ct-border); }
.header-search.is-open { display: block; }
.search-form { display: flex; gap: 8px; }
.search-field { width: 100%; min-height: 48px; padding: 10px 16px; border: 1px solid var(--ct-border); border-radius: 12px; background: #fff; }
.search-submit, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 18px; border: 0; border-radius: 12px; background: var(--ct-primary); color: #fff; font-weight: 800; text-decoration: none; cursor: pointer; }
.search-submit:hover, .button:hover { background: var(--ct-primary-dark); color: #fff; }

/* Hero */
.hero { overflow: hidden; position: relative; padding: 78px 0 72px; background: linear-gradient(135deg, #eef4ff 0%, #f7fbff 55%, #e9fff9 100%); }
.hero::after { content: ""; position: absolute; width: 420px; height: 420px; right: -150px; top: -190px; border-radius: 50%; background: rgba(21,94,239,.1); }
.hero-inner { position: relative; z-index: 1; max-width: 850px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--ct-primary-dark); font-size: .82rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 24px; height: 3px; border-radius: 4px; background: var(--ct-accent); }
.hero h1 { max-width: 780px; margin: 0; font-size: clamp(2.35rem, 6vw, 4.65rem); line-height: 1.04; letter-spacing: -.055em; }
.hero p { max-width: 680px; margin: 22px 0 28px; color: var(--ct-muted); font-size: 1.18rem; }
.hero .search-form { max-width: 720px; padding: 8px; border: 1px solid rgba(21,94,239,.15); border-radius: 16px; background: #fff; box-shadow: var(--ct-shadow); }
.hero .search-field { border: 0; outline: 0; }
.trust-line { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 22px; color: var(--ct-muted); font-size: .88rem; }
.trust-line span::before { content: "✓"; margin-right: 7px; color: var(--ct-accent); font-weight: 900; }

/* Layout and cards */
.section { padding: 64px 0; }
.section-soft { background: var(--ct-soft); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.15; letter-spacing: -.035em; }
.section-heading p { max-width: 600px; margin: 7px 0 0; color: var(--ct-muted); }
.section-link { white-space: nowrap; font-size: .92rem; font-weight: 800; }
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.category-card { position: relative; padding: 25px; border: 1px solid var(--ct-border); border-radius: var(--ct-radius); background: var(--ct-surface); box-shadow: 0 6px 20px rgba(20,33,61,.04); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.category-card:hover { transform: translateY(-4px); border-color: rgba(21,94,239,.35); box-shadow: var(--ct-shadow); }
.category-card a::after { content: ""; position: absolute; inset: 0; }
.category-icon { display: grid; width: 48px; height: 48px; margin-bottom: 18px; place-items: center; border-radius: 14px; background: #edf3ff; color: var(--ct-primary); font-size: 1.35rem; font-weight: 900; }
.category-card:nth-child(2n) .category-icon { background: #e8fbf7; color: #07806d; }
.category-card h3 { margin: 0 0 7px; font-size: 1.08rem; line-height: 1.25; }
.category-card h3 a { color: var(--ct-ink); text-decoration: none; }
.category-card p { margin: 0; color: var(--ct-muted); font-size: .9rem; line-height: 1.55; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.post-card { overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--ct-border); border-radius: var(--ct-radius); background: #fff; box-shadow: 0 6px 20px rgba(20,33,61,.04); }
.post-card-media { display: block; aspect-ratio: 16/9; overflow: hidden; background: #eaf0f8; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.post-card:hover .post-card-media img { transform: scale(1.035); }
.post-card-body { display: flex; flex: 1; flex-direction: column; padding: 22px; }
.post-card-category { margin-bottom: 8px; color: var(--ct-primary); font-size: .75rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.post-card h2, .post-card h3 { margin: 0 0 10px; font-size: 1.18rem; line-height: 1.35; letter-spacing: -.02em; }
.post-card h2 a, .post-card h3 a { color: var(--ct-ink); text-decoration: none; }
.post-card p { margin: 0 0 18px; color: var(--ct-muted); font-size: .92rem; line-height: 1.6; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: auto; color: var(--ct-muted); font-size: .78rem; }
.featured-grid { display: grid; grid-template-columns: 1.4fr .6fr; gap: 26px; }
.featured-main { min-height: 430px; }
.featured-main .post-card-media { aspect-ratio: 16/8.8; }
.featured-main h2 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.featured-side { display: grid; gap: 16px; }
.compact-card { display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 14px; border: 1px solid var(--ct-border); border-radius: 15px; background: #fff; }
.compact-card img { width: 112px; height: 92px; object-fit: cover; border-radius: 10px; }
.compact-card h3 { margin: 5px 0; font-size: .97rem; line-height: 1.35; }
.compact-card h3 a { color: var(--ct-ink); text-decoration: none; }

/* Content pages */
.page-header { padding: 56px 0 38px; background: var(--ct-soft); border-bottom: 1px solid var(--ct-border); }
.page-header h1 { max-width: 850px; margin: 0; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.08; letter-spacing: -.045em; }
.page-header p { max-width: 760px; margin: 15px 0 0; color: var(--ct-muted); }
.breadcrumbs { margin-bottom: 17px; color: var(--ct-muted); font-size: .82rem; }
.breadcrumbs a { color: var(--ct-muted); }
.content-layout { display: grid; grid-template-columns: minmax(0, 780px) minmax(240px, 1fr); gap: 48px; align-items: start; }
.article-wrap { padding: 48px 0 70px; }
.article-header h1 { margin: 10px 0 18px; font-size: clamp(2.1rem, 5vw, 3.75rem); line-height: 1.08; letter-spacing: -.045em; }
.article-lead { color: var(--ct-muted); font-size: 1.15rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 12px 22px; padding: 16px 0; color: var(--ct-muted); font-size: .86rem; }
.article-thumbnail { overflow: hidden; margin: 25px 0 36px; border-radius: var(--ct-radius); }
.article-thumbnail img { display: block; width: 100%; }
.entry-content { font-size: 1.04rem; }
.entry-content h2, .entry-content h3 { scroll-margin-top: 105px; color: var(--ct-ink); line-height: 1.25; letter-spacing: -.025em; }
.entry-content h2 { margin: 2.1em 0 .65em; font-size: 1.75rem; }
.entry-content h3 { margin: 1.65em 0 .55em; font-size: 1.3rem; }
.entry-content p, .entry-content ul, .entry-content ol { margin-block: 0 1.35em; }
.entry-content li { margin-bottom: .45em; }
.entry-content img { border-radius: 12px; }
.entry-content blockquote { margin: 2em 0; padding: 18px 24px; border-left: 4px solid var(--ct-primary); border-radius: 0 12px 12px 0; background: var(--ct-soft); }
.entry-content code { padding: .14em .35em; border-radius: 5px; background: #edf1f7; font-size: .9em; }
.entry-content pre { overflow: auto; padding: 20px; border-radius: 14px; background: #101828; color: #eef3ff; }
.entry-content pre code { padding: 0; background: transparent; color: inherit; }
.entry-content table { width: 100%; margin: 1.5em 0; border-collapse: collapse; font-size: .92rem; }
.entry-content th, .entry-content td { padding: 12px; border: 1px solid var(--ct-border); text-align: left; }
.entry-content th { background: var(--ct-soft); }
.solution-box { margin: 25px 0; padding: 22px 24px; border: 1px solid #a9d8cd; border-radius: 15px; background: #effbf8; }
.article-sidebar { position: sticky; top: 104px; }
.toc, .sidebar-box { margin-bottom: 22px; padding: 22px; border: 1px solid var(--ct-border); border-radius: 15px; background: #fff; }
.toc h2, .sidebar-box h2 { margin: 0 0 14px; font-size: 1rem; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 7px 0; font-size: .83rem; line-height: 1.45; }
.toc a { color: var(--ct-muted); text-decoration: none; }
.toc a:hover { color: var(--ct-primary); }
.sidebar-posts, .subcategory-menu { margin: 0; padding: 0; list-style: none; }
.sidebar-posts li { padding: 11px 0; border-bottom: 1px solid var(--ct-border); }
.sidebar-posts li:last-child { padding-bottom: 0; border-bottom: 0; }
.sidebar-posts a { color: var(--ct-ink); font-size: .87rem; font-weight: 750; line-height: 1.4; text-decoration: none; }
.sidebar-posts a:hover { color: var(--ct-primary); }
.subcategory-menu li + li { margin-top: 7px; }
.subcategory-menu a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; border-radius: 9px; background: var(--ct-soft); color: var(--ct-ink); font-size: .86rem; font-weight: 700; text-decoration: none; }
.subcategory-menu a:hover { background: #e8f0ff; color: var(--ct-primary); }
.subcategory-count { color: var(--ct-muted); font-size: .75rem; font-weight: 600; }
.author-box { display: grid; grid-template-columns: 72px 1fr; gap: 18px; margin-top: 45px; padding: 24px; border: 1px solid var(--ct-border); border-radius: var(--ct-radius); background: var(--ct-soft); }
.author-box img { border-radius: 50%; }
.author-box h2 { margin: 0 0 4px; font-size: 1.05rem; }
.author-box p { margin: 0; color: var(--ct-muted); font-size: .9rem; }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination .page-numbers { min-width: 42px; padding: 8px 12px; border: 1px solid var(--ct-border); border-radius: 9px; text-align: center; text-decoration: none; }
.pagination .current { background: var(--ct-primary); color: #fff; border-color: var(--ct-primary); }

/* Feedback tutorial */
.tutorial-feedback { margin-top: 42px; padding: 24px; border: 1px solid var(--ct-border); border-radius: var(--ct-radius); background: linear-gradient(135deg, #f7faff, #f1fcf9); }
.feedback-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.feedback-copy h2 { margin: 0 0 4px; font-size: 1.15rem; }
.feedback-copy p { margin: 0; color: var(--ct-muted); font-size: .88rem; }
.feedback-actions { display: flex; gap: 10px; }
.feedback-button { display: inline-flex; align-items: center; gap: 7px; min-width: 88px; padding: 10px 14px; border: 1px solid var(--ct-border); border-radius: 12px; background: #fff; color: var(--ct-ink); font-weight: 800; cursor: pointer; }
.feedback-button:hover, .feedback-button:focus { border-color: var(--ct-primary); color: var(--ct-primary); }
.feedback-button[disabled] { opacity: .58; cursor: default; }
.feedback-button.is-selected { border-color: var(--ct-accent); background: #e8fbf7; color: #067563; opacity: 1; }
.feedback-status { min-height: 1.35em; margin: 12px 0 0; color: var(--ct-muted); font-size: .8rem; }
.feedback-status.is-success { color: #067563; font-weight: 700; }

/* Footer */
.site-footer { padding: 52px 0 24px; background: #101828; color: #bdc7d9; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 48px; }
.site-footer h2 { margin: 0 0 13px; color: #fff; font-size: 1.05rem; }
.site-footer a { color: #d9e4f7; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer li { margin-bottom: 8px; }
.footer-bottom { margin-top: 42px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: .82rem; }

@media (max-width: 980px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .featured-grid, .content-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
  .featured-side { grid-template-columns: repeat(2, 1fr); }
  .menu-toggle { display: inline-flex; }
  .main-navigation { display: none; position: absolute; left: 0; right: 0; top: 76px; padding: 20px; border-bottom: 1px solid var(--ct-border); background: #fff; }
  .main-navigation.is-open { display: block; }
  .primary-menu { align-items: stretch; flex-direction: column; gap: 5px; }
  .primary-menu a { display: block; padding: 10px; }
}

@media (max-width: 680px) {
  body.admin-bar .site-header { top: 46px; }
  .container { width: min(calc(100% - 28px), var(--ct-width)); }
  .hero { padding: 54px 0; }
  .hero .search-form { flex-direction: column; }
  .section { padding: 48px 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .category-grid, .post-grid, .featured-side, .footer-grid { grid-template-columns: 1fr; }
  .compact-card { grid-template-columns: 92px 1fr; }
  .compact-card img { width: 92px; height: 82px; }
  .article-wrap { padding-top: 30px; }
  .author-box { grid-template-columns: 52px 1fr; }
  .feedback-row { align-items: flex-start; flex-direction: column; }
  .feedback-actions { width: 100%; }
  .feedback-button { flex: 1; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
